Project

General

Profile

Files » run_job.sh

Example of run script to execute the NEMO traadv kernel - Giovanni Aloisio, 02/10/2016 04:02 PM

 
1
#!/bin/bash 
2
#!
3
#BSUB -q poe_short
4
#BSUB -n PROCS
5
#BSUB -x
6
#BSUB -R "span[ptile=16]"
7
#BSUB -a poe
8
#BSUB -J traadv_kernel
9
#BSUB -o stdout.PROCSprc.%J
10
#BSUB -e stderr.PROCSprc.%J
11

    
12
######################################################################################################################
13
# for running this run script you can use the following syntax
14
#
15
# cat run_job.sh | sed "s/PROCS/4/" | bsub
16
# 4 represents the number of processes to use
17
#
18
# or you can use the following syntax for a bundle of submissions
19
#
20
# for i in 1 2 4 8 16 32 64 128 256 512 1024; do cat run_job.sh | sed "s/PROCS/$i/" | bsub; done
21
# the command will submit the run script with 1,2,4,8,16,32,64,128,256,512,1024 processes (a total of 11 submissions)
22
######################################################################################################################
23

    
24
total_proc=PROCS
25

    
26
if [ $PROCS > 16 ]; then
27
   nodes=$((PROCS  / 16))
28
else
29
   nodes=1
30
fi
31

    
32
export CPU_PER_TASK=1
33

    
34
ljpi_mfs=871
35
ljpj_mfs=253
36

    
37
lcpux=`echo "val=l(sqrt($total_proc*($ljpi_mfs-3)/($ljpj_mfs-3)))/l(2)+0.5 ; scale=0; 2^(val/1)"| bc -l`
38
lcpuy=$((total_proc / lcpux))
39
if [ $lcpuy = 0 ]; then
40
    lcpuy=1
41
    lcpux=$total_proc
42
fi
43

    
44
jpi=$(( (ljpi_mfs + lcpux - 3) / lcpux ))
45
jpj=$(( (ljpj_mfs + lcpuy - 3) / lcpuy ))
46

    
47
export PROC_X=${lcpux}
48
export PROC_Y=${lcpuy}
49
export JPI=${jpi}
50
export JPJ=${jpj}
51
export JPK=72
52

    
53
echo
54
echo "GLOBAL DOMAIN MFS LIKE (16M grid points)"
55
echo
56

    
57
time mpirun.lsf tra_adv
58

    
59
echo
60
echo "GLOBAL DOMAIN: BIGGEST (600M grid points)"
61
echo
62

    
63
ljpi_big=5760
64
ljpj_big=1440
65

    
66
lcpux=`echo "val=l(sqrt($total_proc*($ljpi_big-3)/($ljpj_big-3)))/l(2)+0.5 ; scale=0; 2^(val/1)"| bc -l`
67
lcpuy=$((total_proc / lcpux))
68
if [ $lcpuy = 0 ]; then
69
    lcpuy=1
70
    lcpux=$total_proc
71
fi
72

    
73
jpi=$(( (ljpi_big + lcpux - 3) / lcpux ))
74
jpj=$(( (ljpj_big + lcpuy - 3) / lcpuy ))
75

    
76
export PROC_X=${lcpux}
77
export PROC_Y=${lcpuy}
78
export JPI=${jpi}
79
export JPJ=${jpj}
80
export JPK=32
81

    
82
time mpirun.lsf tra_adv
(1-1/3)