Search

link to homepage

Institute for Advanced Simulation (IAS)

Navigation and service


How to use system calls on JUGENE?

Because the compute nodes on the Blue Gene/P do not have a full Linux kernel implementation, some system routines are not available. Especially the "fork()", the "exec()" and the "call system" in FORTRAN do not work. However, there are replacement routines which can be used instead. You can find available routines in the Blue Gene/P Application Development Redbook

Hints for FORTRAN users: These routines are C routines but the FORTRAN compiler includes them automatically as well. You just have to be careful when using strings, they have to have the "\\0" as last character. You can either add this to the string which you pass to the C routines or you can use the following compiler flag:

-qnullterm

Here an example FORTRAN program which renames "file1" to "file1a" and "file2" to "file2a":

program system_calls
  implicit none
  include 'mpif.h'
  character*5 :: filen1='file2'
character*6 :: filen2='file2a'
  integer ierror,nranks,my_rank
  call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD,nranks,ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD,my_rank,ierror)
  if (my_rank == 0) then
write(*,*) 'Moving file1 to file1a'
call rename("file1","file1a")
write(*,*) 'Moving ',filen1,' to ',filen2
call rename(filen1,filen2)
endif
  call MPI_FINALIZE(ierror)
end
Compilation:
mpixlf90 -qnullterm *.f90

Servicemeu

Homepage