Anyone know the static compile option for pgfortran? I’ve tried -static and -Mstatic and neither works. And I’m not seeing much in “man pgfortran” as of yet as I search through it.
Linux or Windows?
This is the man page from Linux:
-Bstatic
(Linux only) Passed to the linker to specify static binding.-Bstatic_pgi
(Linux only) Statically link in the PGI libraries, while using dynamic linking for the system libraries; implies -Mnorpath.
- Mat
Thanks Mike!
One last question, I’m trying to make the static executable with cuda, but I’m getting the following error.
/usr/bin/ld: cannot find -lcudart
The thing is, there is no ld folder in /usr/bin/ that I can find under redhat enterprise 6.
This doesn’t appear to be a library I can install with yum either. So I tried taking all of the 32 and 64 bit cuda libraries like libcudart.so.4 and putting them into a folder then using the -L command like below, but that doesn’t seem to do much either.
pgfortran -Mcuda -Bstatic -L/home/leiderml/cudart/64bit -L/home/leiderml/cudart/32bit i4fiveCase8Cuda.o ibe25CudaF.f
I know the cudart files are all in the pgi install folder as well under the 2012 folder. So I’m not sure what to do to fix this as all of these errors I find on google seem to involve running yum or apt-get install. And this error only happens when I try to make a static executable, I can make and run non-static cuda code no problem.
Any recommendations?
Thanks!
Morgan
Hi Morgan,
Unfortunately, NVIDIA doesn’t ship a static version of the CUDA runtime library. You can use “-Bstatic_pgi” to statically link the PGI libraries, but you’ll need to dynamically link cudart.
- Mat
Hello,
What is the procedure to link cudart dynamically as you have suggested in this thread?
Regards,
Gary Franklin
Look at the output of
pgfortran -acc -ta=tesla,cuda8.0 foo.o -o foo -dryrun
and compare it with
pgfortran -acc -ta=tesla,cuda8.0 foo.o -o foo -dryrun -Mcuda
and I think you will see
-L$PGI/linux86-64/2017/cuda/8.0/lib64
in the second output, and not in the first.
That is why it can’t find -lcudart .
dave
What is the procedure to link cudart dynamically as you have suggested in this thread?
Adding the flag “-Mcuda”, “-acc”, or “-ta=tesla” will implicitly add libcudart to the link.
-Mat