Compiler failure with: undefined reference to `random_init_'

Hi,

I have a code that uses the Fortran intrinsic

call RANDOM_INIT (.true., .true.)

followed by calls to RANDOM_SEED().

It works with GCC (gfortran), but when trying to compile with nvfortran, I get:

nvfortran -O3 -march=native -mp -stdpar=multicore ...

/usr/bin/ld: conflow.o: in function `MAIN_':
conflow.f90:355: undefined reference to `random_init_'
pgacclnk: child process exit status 1: /usr/bin/ld
make: *** [Makefile:10: all] Error 2

The code can be checked out here: ConFlow

– Ron

Hi Ron,

It’s a F2018 feature which isn’t supported in nvfortran.

In case you’re not aware, we’re working with the LLVM community on the new flang (aka F18) project which is a complete, “from the ground up”, rewriting of our Fortran front-end. Our efforts for new Fortran language features are being put into flang, which will likely replace nvfortran once it’s feature complete.

If important, I can ask engineering about adding RANDOM_INIT to nvfortran, but otherwise, you might consider trying it with new flang.

-Mat

Hi,

Is there an ETA for flang to work as smoothly as nvfortran does now?
I have not had a lot of luck compiling things with flang in the past.

As for the importance of the feature, the code conflow is part of a larger code package called OFT.
The HipFT code (that uses standard Fortran) GPU code is also part of OFT.

This means that if I want to install all components of OFT in the same nvhpc compiler environment in order to take advantage of the GPU features in HipFT, the compilation of conflow will not work. I suppose I could try compiling that with GCC separately, but a lot of the environment variables in my nvhpc environment are linked to nvfortran compiled libraries. So even if I separately compiled the conflow code, my LD_LIBRARY_PATH would be conflicted between the codes.

Basically - it would be really useful to us to have RANDOM_INIT (.true., .true.) and RANDOM_SEED() working in nvhpc until the new flang is ready to go.

– Ron

Hi,

Is there any updates to whether or not this language feature will be implemented into nvfortran, and if so, when?

– Ron

I talked with engineering and they said that RANDOM_INIT is only useful with multiple images and co-arrays. RANDOM_INIT with a single image is the same as RANDOM_SEED. So don’t see a reason to implement it until images are supported (which will be in the future flang based compiler).

Thanks for the info!

I commented out the RANDOM_INIT() and the rest of the RANDOM_SEED() and RANDOM_NUMBER() calls work just fine.

[SOLVED]

– Ron