nvvmCompileProgram error: 9.

Hi again,

a code that compiles and runs OK in the no-OpenACC version, gives the following error when compiled with OpenACC support, and I have no idea how to go about fixing it.

nvvmCompileProgram error: 9.                                                                                                                                                                                                    
Error: /tmp/pgaccrJKbZj2FzDs8.gpu (1971, 36): parse '@Faddeeva_w' defined with type '%struct.__dcomplex (%struct.__dcomplex, double)*'

The code calculates de Faddeeva function, and it is the code mentioned in http://ab-initio.mit.edu/wiki/index.php/Faddeeva_Package.

For ease, I have uploaded the original code (and the changes I did) to https://filenurse.com/download/7adb7e4d6d6730c66af07d2943b6a697.html

As it is, if I compile without -acc I get no problems:

[angelv@deimos Fad_MIT]$ pgcc  -c -cpp  -o fad.o Faddeeva.c
[...]
PGC/x86-64 Linux 18.3-0: compilation completed with warnings                                                                                                                                                                    
[angelv@deimos Fad_MIT]$

But if I compile with -acc support I get the following:

[angelv@deimos Fad_MIT]$ pgcc  -c -cpp -ta=tesla:cc60 -acc -o fad.o Faddeeva.c  
[...]                                                                                                                                                                               
nvvmCompileProgram error: 9.                                                                                                                                                                                                    
Error: /tmp/pgaccuode8IXo0OuB.gpu (2002, 36): parse '@Faddeeva_w' defined with type '%struct.__dcomplex (%struct.__dcomplex, double)*'                                                                                          
PGC-S-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (Faddeeva.c: 1)                                                                                 
PGC/x86-64 Linux 18.3-0: compilation completed with severe errors                                                                                                                                                               
[angelv@deimos Fad_MIT]$

You can see the few changes that I did to try to get it to compile with PGI and OpenACC by diff’ing Faddeeva_original.cc and Faddeeva_oacc.cc.

I guess this is related to bug FS#25493, which I reported the other day (https://forums.developer.nvidia.com/t/nvlink-error-prototype-doesnt-match-fortran-c-openacc/135666/1), but not completely sure.

Any idea if/how this can be fixed?

Thanks,
AdV

Hi AdV,

This looks like a code generation bug when passing in the complex type to a device subroutine. Specifically when passing “z” to “FADDEEVA(w)”

#pragma acc routine seq
void FADDEEVA(subw)(double a, double v, double relerr,double *out_real, double *out_imag) {
  cmplx z;
  cmplx ret;

  z = C(v,a);
  //  z = v + _Complex_I*a;
  ret = FADDEEVA(w)(z,relerr);
  *out_real = creal(ret);
  *out_imag = cimag(ret);

  //  printf("FAD %g %g %g %g %g",a,v,relerr,*out_real,*out_imag);
}

I’ve created a new bug report, TPR#25528, and sent to engineering. It might be related to the other bug you reported last week since they’re both calling the same device routine.

I was able to work around the problem by inlining the routine.

% pgcc -c -o fad.o Faddeeva.c -ta=tesla:cc60 -w -V18.3 -Minline
PGC/x86-64-Extractor Linux 18.3-0: completed with warnings
PGC/x86-64 Linux 18.3-0: compilation completed with warnings

Can you try using -Minline to see if it helps?

-Mat

Hi,

with -Minline I managed to get it working. So now the question is to get good performance, but I will post that in another thread.

Many thanks,