how to pass nvlink options in pgfortran

I am compiling a cuda fortran code and getting this error:

nvlink error : Entry function ‘function-name’ uses too much data for compiler-generated constants; please recompile with -Xptxas --disable-optimizer-constants

But the problem is option “-Xptxas --disable-optimizer-constants” does not work with pgfortran compiler:

pgfortran-Error-Unknown switch: -Xptxas
pgfortran-Error-Unknown switch: --disable-optimizer-constants

Is there any way to pass the options through pgfortran?

Any help is appreciated. Thanks in advance.

Hi fhu,

Is there any way to pass the options through pgfortran?

No, sorry. There isn’t a way to pass options to nvlink.

Though, I doubt it would help here since the problem is that you’re using too much constant memory which will cause your program to silently fail at runtime.

Can you try removing the “constant” attribute from one or more of your variables until it fits?

-Mat

Hello Mat,

I am not using any constant variables, I think these are compiler-generated constants.

I am using compiler version 18. The same code has been compiled previously no problem under version 16.10.

It appears the compiler is doing some sort of optimization by some default setting. Is there a way to disable the optimizer under pgfortran?

Hi fhu,

Do you have several parameter arrays in you modules? One change we made in 18.1 was to store module parameter arrays in constant memory. It’s possible that you’re encountering an issue due to this.

-Mat

Hi Mat,

The change in parameter storage may be responsible for the error message.

The compilation is now successful when the option -Mcuda=cc2.0 is used.

Thank you for your help.

Fang

Hi Fang,

If you can, please post or send a reproducing example to PGI Customer Service (support@pgroup.com) so we can have our compiler engineers take a look at the problem.

Thanks,
Mat