I have a numerical code that works with “gfortran” and “mpif90”. The code is parallelized with mpi.
I want the code to run on multiple CPUs-GPUs. The idea is to take advantage of CPU parallelization to split the work and associate a GPU to each CPU to accelerate the computations.
I am compiling the code with “nvfortran” and “mpif90” (NVIDIA HPC SDK Current Release Downloads | NVIDIA Developer, release 22.3, in Linux). At the moment, I just added “use cudafor” in the “main.cuf” and got the GPU characteristics, using:
type (cudaDeviceProp) :: prop
The code compiles and links, and identifies the GPUs. However, I cannot read the input files with the “open” subroutine (this works perfectly with the CPU version)
The compile flags I am using are:
NVIDIA_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/22.3
MPI_INSTALL_PATH=$(NVIDIA_PATH)/comm_libs/hpcx/hpcx/hpcx-2.10/ompi
CUDA_INSTALL_PATH=$$(NVIDIA_PATH)/compilers
COMIPLER = $(MPI_INSTALL_PATH)/bin/mpif90
FLAGS = -O2 -DCUDA -cuda -acc -Mfree -Mpreprocess
When executing the program, it generates an error in line:
open( newunit = funit, &
file = trim(adjustl(adjustl(fopen%fname)), &
form = trim(adjustl(adjustl(fopen%fform)), &
status = trim(adjustl(adjustl(fopen%fstat)), &
action = trim(adjustl(adjustl(fopen%factn)), &
position = trim(adjustl(adjustl(fopen%fpost)), &
access = trim(adjustl(adjustl(fopen%faccs)), &
convert = trim(adjustl(adjustl(fopen%fcnvt)), &
iostat = ioerr )
where ioerr = 201 or 202
I understand that it is a problem with the versions and that I can fix it by adding the appropriate flags in the compilation and linking.
I would appreciate it if anyone could help me, I have been dealing with this for days, and I am unable to get it to work.