Using the Fortran Interfaces to the NVSHMEM library

Hi,

I am new to NVSHMEM and trying to figure out how to use it inside a Fortran program.

I have a simple C++ code that I can compile with nvcc -I $NVSHMEM_HOME/include -L $NVSHMEM_HOME/lib -lnvshmem test.cu -o test and run with srun -n X ./test without any problem:

#include <nvshmem.h>

int main(int argc, char *argv[])
{
   nvshmem_init();
   nvshmem_finalize();
   return 0;
}

But when I try to compile its Fortran counterpart, I get an undefined reference error for each NVSHMEM call:

program main
   use nvshmem
   implicit none
   call nvshmem_init()
   call nvshmem_finalize()
end program main

I believe there is no Fortran-to-C interface that comes with NVSHMEM installation. How do I use the NVSHMEM interface or link the Fortran NVSHMEM module when compiling the code?

Thanks!

I believe there is no Fortran-to-C interface that comes with NVSHMEM installation. How do use the NVSHMEM interface or link the Fortran NVSHMEM module when compiling the code?

AFAIK, there are Fortran bindings for NVSHMEM that exist inside of HPC SDK - there are not natively maintained as part of NVSHMEM sources, but exists as part of HPC SDK distribution under NVIDIA Fortran CUDA interfaces: NVIDIA Fortran CUDA Library Interfaces Version 24.3 for ARM, OpenPower, x86