Katana Login Node Scratch Disk Usage
In this page, the procedure for using the login node's scratch for
running jobs interactively or in an interactive batch environment is described.
Unlike the compute nodes' scratch, the login node's scratch is always
mounted. On the login node, you can access it simply with
katana:~ % cd /scratch/mydir
or
katana:~ % cd /net/katana/scratch/mydir
Both of the above are fully equivalent.
In an interactive batch environment, you are actually on a
compute node, so that "cd /scratch" will send you to "/net/katana-aXX/scratch".
It is recommended that the user store files in a user-created
sub-directory (mkdir /scratch/userID) for the user's own
file management purposes.
Enclosed below is an MPI FORTRAN program in which
each processor (or rank, in MPI terminology) writes its rank number (as output) to the Katana scratch
in a file whose name has the rank built into it. The master process
(or rank 0) writes also the sum of the ranks to its corresponding file.
Program Scratch_Example
implicit none
include "mpif.h"
integer p, total, ierr, master, myid, my_int, dest, tag
character*40 filename
data master, tag, dest/0, 0 ,0/
c**Starts MPI processes ...
call MPI_Init(ierr) ! starts MPI
call MPI_Comm_rank(MPI_COMM_WORLD, myid, ierr) ! get current process id
call MPI_Comm_size(MPI_COMM_WORLD, p, ierr) ! get # procs
C**define and open output file for each rank to katana LOGIN NODE scratch
write(filename,"('/scratch/kadin/myoutput.dat.',i1)")myid
open(unit=11, file=filename,form='formatted',status='unknown')
my_int = myid ! result of local proc
C**write local output to its own output file
write(11,"('Contents of process ',i2,' is ',i8)")myid,my_int
call MPI_Reduce(my_int, total, 1, MPI_INTEGER, MPI_SUM, dest,
& MPI_COMM_WORLD, ierr)
if(myid .eq. master) then
write(11,*)'The sum is =', total ! writes total to master output file
endif
close(11)
call MPI_Finalize(ierr) ! MPI finish up ...
end
Before running the job, you need to create the subdirectory kadin, expected in the
source program above, if it doesn't already exist.
katana:~ % cd /scratch
katana:~ % mkdir kadin
Once the job completes, you can access the output files generated
as follows:
katana:~ % cd /scratch/kadin
katana:/scratch/kadin % pwd
/scratch/kadin
katana:/scratch/kadin % ls
myoutput.dat.0 myoutput.dat.1 myoutput.dat.2 myoutput.dat.3
katana:/scratch/kadin % cat my*
Contents of process 0 is 0
The sum is = 6
Contents of process 1 is 1
Contents of process 2 is 2
Contents of process 3 is 3
katana:/scratch/kadin %
All four output files appear in the same directory because whether you are
running the job interactively (on the login node katana) or interactive
batch (with which "-pe omp 4" would be used), there is only one node involved.
|