Libraries used in Fortran OpenACC


Is there a standard or typical set of libraries that are linked when a Fortran OpenACC code is linked? I need to know this to attempt building a Python module using Fortran OpenACC code.



Hi Jeff,

The easiest thing to do is use the PGI flag “-dryrun -acc” to see what libraries being passed to the linker. Be sure to use the same flag that you use with your project. Then look for the needed libraries. For example:

% pgfortran -dryrun -acc x.o
/proj/pgi/linux86-64/135093-dev/bin/pgacclnk -nvidia /proj/pgi/linux86-64/135093-dev/bin/pgnvd -cuda7.5 -computecap=30 -computecap=35 -computecap=50 /usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /proj/pgi/linux86-64/135093-dev/lib/trace_init.o /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtbegin.o /proj/pgi/linux86-64/135093-dev/lib/initmp.o /proj/pgi/linux86-64/135093-dev/lib/f90main.o --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ /proj/pgi/linux86-64/135093-dev/lib/pgi.ld -L/proj/pgi/linux86-64/135093-dev/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 x.o -rpath /proj/pgi/linux86-64/135093-dev/lib -rpath /proj/pgi/linux86-64/20XX-dev/cuda/7.5/lib64 -rpath /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64 /proj/pgi/linux86-64/135093-dev/lib/acc_init_link_cuda.o -laccapi -laccg -laccn -laccg2 -ldl -lcudadevice -lpgf90rtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgmp -lnuma -lpthread -lpgm -lnspgc -lpgc -lpgm -lrt -lpthread -lm -lgcc -lc -lgcc -lgcc_s /usr/lib/gcc/x86_64-redhat-linux/4.8.5/crtend.o /usr/lib64/crtn.o

Would use the following libraries. Though, the system and GNU libraries may or may not be needed with Python.

-laccapi -laccg -laccn -laccg2 -ldl -lcudadevice -lpgf90rtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgmp -lnuma -lpthread -lpgm -lnspgc -lpgc -lpgm -lrt -lpthread -lm -lgcc -lc -lgcc -lgcc_s
  • Mat