CUDA Fortran can not compile

Hello, Mat!

I have a CUDA Fortran program. It can not compile. The error message is

------ : : CudaSceuaXajDaily, : Release Win32 ------
Deleting intermediate and output files for project 'CudaSceuaXajDaily', configuration 'Release'
Compiling Project  ...
UserDefinedType.f90
ArrayFunction.f90
CudaKernel.cuf
ptxas : fatal error : Memory allocation failure
pgnvd-Fatal-Could not spawn c:\program files (x86)\pgi\win32/2013/cuda/5.0/bin\ptxas.exe
D:\PGI Visual Fortran 13.9\SceuaXaj\CudaSceuaXajDaily\CudaSceuaXajDaily\CudaKernel.cuf(1) : error F0155 : Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code
PGF90/x86 Windows 13.9-0: compilation aborted
curand_module.cuf
thrust_module.cuf
DailyVariable.f90
CudaSceua.cuf
ptxas : info : 4 bytes gmem, 4 bytes cmem[2], 4 bytes cmem[14]
ptxas : info : Compiling entry function 'sceuacuda_281_gpu' for 'sm_20'
ptxas : info : Function properties for sceuacuda_281_gpu
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 15 registers, 52 bytes cmem[0]
ptxas : info : Compiling entry function 'sceuacuda_199_gpu' for 'sm_20'
ptxas : info : Function properties for sceuacuda_199_gpu
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 15 registers, 52 bytes cmem[0]
ptxas : info : Compiling entry function 'sceuacuda_283_gpu_red' for 'sm_20'
ptxas : info : Function properties for sceuacuda_283_gpu_red
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 9 registers, 52 bytes cmem[0]
ptxas : info : Compiling entry function 'sceuacuda_201_gpu_red' for 'sm_20'
ptxas : info : Function properties for sceuacuda_201_gpu_red
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 9 registers, 52 bytes cmem[0]
ptxas : info : 4 bytes gmem, 4 bytes cmem[3]
ptxas : info : Compiling entry function 'sceuacuda_281_gpu' for 'sm_30'
ptxas : info : Function properties for sceuacuda_281_gpu
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 15 registers, 340 bytes cmem[0]
ptxas : info : Compiling entry function 'sceuacuda_199_gpu' for 'sm_30'
ptxas : info : Function properties for sceuacuda_199_gpu
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 15 registers, 340 bytes cmem[0]
ptxas : info : Compiling entry function 'sceuacuda_283_gpu_red' for 'sm_30'
ptxas : info : Function properties for sceuacuda_283_gpu_red
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 9 registers, 340 bytes cmem[0]
ptxas : info : Compiling entry function 'sceuacuda_201_gpu_red' for 'sm_30'
ptxas : info : Function properties for sceuacuda_201_gpu_red
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 9 registers, 340 bytes cmem[0]
sceuacuda:
    199, CUDA kernel generated
        199, !$cuf kernel do <<< (*), (128) >>>
    200, Min reduction generated for rmin
    201, Max reduction generated for rmax
    281, CUDA kernel generated
        281, !$cuf kernel do <<< (*), (128) >>>
    282, Min reduction generated for rmin
    283, Max reduction generated for rmax
FileFunction.f90
DateTimeFunction.f90
XajFunction.f90
CudaKernel.cuf
ptxas : fatal error : Memory allocation failure
pgnvd-Fatal-Could not spawn c:\program files (x86)\pgi\win32/2013/cuda/5.0/bin\ptxas.exe
D:\PGI Visual Fortran 13.9\SceuaXaj\CudaSceuaXajDaily\CudaSceuaXajDaily\CudaKernel.cuf(1) : error F0155 : Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code
PGF90/x86 Windows 13.9-0: compilation aborted
CudaSceuaXajDaily.f90
DailyApi.f90
D:\PGI Visual Fortran 13.9\SceuaXaj\CudaSceuaXajDaily\CudaSceuaXajDaily\DailyApi.f90(280) : error S0188 : Argument number 1 to integersredimpreserverow: type mismatch
  0 inform,   0 warnings,   1 severes, 0 fatal for daily_flood_append
ToolApi.f90
CudaSceuaXajDaily build failed.
Build log was saved at "file://D:\PGI Visual Fortran 13.9\SceuaXaj\CudaSceuaXajDaily\CudaSceuaXajDaily\Win32\Release\BuildLog.htm"

========== :  0  1  0  ==========

I use the PVF 13.9 and VS 2012.

How to solve this?

Can you give me an E-mail, I’ll send you the source code.

Thank you!

Nightiwish

Hi Nightwish,

CudaKernel.cuf 
 ptxas : fatal error : Memory allocation failure 
 pgnvd-Fatal-Could not spawn c:\program files (x86)\pgi\win32/2013/cuda/5.0/bin\ptxas.exe 
 D:\PGI Visual Fortran 13.9\SceuaXaj\CudaSceuaXajDaily\CudaSceuaXajDaily\CudaKernel.cuf(1) :

It looks like the CUDA assembler, ptxas, is running out of memory when trying to compile. Not sure if this is a bug in ptxas or if your kernel is just to large to compile in 32-bits.

Please send “CudaKernel.cuf” and any dependent files to PGI Customer Service (trs@pgroup.com) and I’ll take a look.

  • Mat

Hi, Mat!

Thank you very much! I have sent all the source code to the E-mail trs@pgroup.com.

I have additional information about the problem. When I only use global memory, no error, it can be compiled and run with right answer. However, when I use texture memory, the error happens.

real,texture,pointer :: Subbasin_t(:,:),AllData_t(:,:),AllInitState_t(:,:,:)
integer,texture,pointer :: InfMusk_t(:),AllIdx_t(:,:)

Nightwish

Hi Nightwish,

I got the code and was able to recreate the error. I’m not sure the issue but it doesn’t appear in the 14.x compilers so would recommend updating to the latest version.

Also, the error goes away if I lower the optimization of “-O1”. In PVF, you can lower to optimization of a single file by setting the optimization level in the file’s property page.

  • Mat

Thank you Mat!

I want to know how to set -O1 in the user interface of PVF 13.9? The “Global Optimization” option seems only have 3 choices, which are Default, -O2, and -O3.

Nightwish

I found how to set -O1. It can compile and run with right answer. Thank you!

Nightiwish