Trying to run a bit of code on a new cluster, however I am having some issues passing some data through mpirun into the fortran code. For note this bit of code has worked on previous clusters but something seems to be different with this cluster.
The cluster is running job submission through BSUB / LSF, I have tried compile the fortran code with ifort and gfortran versions of mpif90.
Specifically I have a job that needs to know its name. I pass this via a HEREDOC statement in the job submission script which looks like (note in the actual code it is an array job where each individual needs to be passed its unique identifier):
#!/bin/bash
#BSUB -q queuename
#BSUB -n 2
#BSUB -o jobname.job.o%J
#BSUB -J jobname.job
#BSUB -e jobname.job.e%J
#BSUB -W 1:00
cd /workingdirectory/
mpirun -lsf /workingdirectory/jobname.exe << EOD
jobname
EOD
Then the fortran script reads the stdin by:
include 'mpif.h'
integer num_procs,n_ranks,ierr
character name*7
call MPI_Init (ierr)
call MPI_Comm_rank (MPI_COMM_WORLD,n_ranks,ierr)
call MPI_Comm_size (MPI_COMM_WORLD,num_procs,ierr)
if (n_ranks == 0) then
read (*,'(a7)') name
write(*,2000) name
end if
2000 format(a7)
However nothing ends up in the standard output and the code hangs indefinitely (well until the wall time runs out).
For note I have also tried entering the input into a file and passing it through the -i tag in BSUB:
#!/bin/bash
#BSUB -q queuename
#BSUB -n 2
#BSUB -i jobname.i
#BSUB -o jobname.job.o%J
#BSUB -J jobname.job
#BSUB -e jobname.job.e%J
#BSUB -W 1:00
cd /workingdirectory/
mpirun -lsf /workingdirectory/jobname.exe
where jobname.i is:
jobname
And still no joy. The calculation can certainly access the storage as if I alter the fortran code to:
include 'mpif.h'
integer num_procs,n_ranks,ierr
character name*7
call MPI_Init (ierr)
call MPI_Comm_rank (MPI_COMM_WORLD,n_ranks,ierr)
call MPI_Comm_size (MPI_COMM_WORLD,num_procs,ierr)
if (n_ranks == 0) then
open (5,file='jobname.i',status='unknown')
read (5,'(a7)') name
write(*,2000) name
end if
2000 format(a7)
Then it works fine. Any suggestions?