Segmentation fault with tcufft2dc3

I tried to compile the tcufft2dc3 sample with the HPC SDK 20.7 and I get a segmentation fault when running the code. This occurs on Ubuntu Linux x86_64 18.06 and CUDA 10.2. These are the compilation flags:

CXXFLAGS  = -fast -acc=gpu -gpu=cuda10.2 -Mcudalib=cufft -std=c++03

tcufft2dc4 compiles and runs properly on the same setup.

What’s the issue with tcufft2dc3?

Hi Andrea,

I tried recreating the issue here, but it works fine for me. I tried various compiler versions, GPUs, CUDA versions, etc., including your specifics, but all ran correctly. Hence the issue is likely something to do with your system or environment.

Can you compile with debugging enabled (i.e. add “-g”), and run it through gdb to see where the segv is coming from? Note a segv occurs in host code.

Could this be a stack overflow? i.e. is your environment’s stacksize limit set too small? The limit can be seen either via “ulimit -s” (bash) or “limit” (csh).

-Mat

Hi @MatColgrove:

I ran the program through cuda-gdb and it crashes in line 11, which makes little sense to me:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000401b2f in main () at tcufft2dc3.cpp:11
11          std::complex<float> a[m*n];

The output of ulimit -s is 8192, which I think is the default for Ubuntu 18.

Does this help?

Definitely a stack overflow given these are static arrays and placed on the stack.

8192 is relatively small. Try increasing your stack size to at least 16,384. I typically set it to unlimited in my .bashrc/.cshrc files so it’s always set when I launch a new shell.

Depending on your shell, the command:

csh: limit stacksize 16384 (or unlimited)
bash: ulimit -s 16384 (or unlimited)

Csh Example:

% limit stacksize 8192
% nvc++ -cuda -acc -cudalib=cufft tcufft2dc3.cpp -fast ; a.out
Segmentation fault
% limit stacksize 16384
% a.out
Max error C2C FWD: (0.0000000e+00,0.0000000e+00)
Max error C2C INV: 0.0000000e+00
Max error R2C/C2R: 0.0000000e+00
 Test PASSED

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.