forked from SPECFEM/specfem3d
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_this_example.sh
executable file
·54 lines (41 loc) · 1.13 KB
/
run_this_example.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
echo "running example: `date`"
currentdir=`pwd`
echo
echo "(will take about 15 minutes)"
echo
# sets up directory structure in current example directory
echo
echo " setting up example..."
echo
rm -f -r OUTPUT_FILES
mkdir -p bin
mkdir -p OUTPUT_FILES
mkdir -p OUTPUT_FILES/DATABASES_MPI
# stores setup
cp DATA/Par_file OUTPUT_FILES/
cp DATA/CMTSOLUTION OUTPUT_FILES/
cp DATA/STATIONS OUTPUT_FILES/
# get the number of processors, ignoring comments in the Par_file
NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2 | cut -d \# -f 1`
echo "The simulation will run on NPROC = " $NPROC " MPI tasks"
# decomposes mesh using the pre-saved mesh files in MESH-default
echo
echo " decomposing mesh..."
echo
./bin/xdecompose_mesh $NPROC ./MESH-default ./OUTPUT_FILES/DATABASES_MPI/
# runs database generation
echo
echo " running database generation on $NPROC processors..."
echo
mpirun -np $NPROC ./bin/xgenerate_databases
# runs simulation
echo
echo " running solver on $NPROC processors..."
echo
mpirun -np $NPROC ./bin/xspecfem3D
echo
echo "see results in directory: OUTPUT_FILES/"
echo
echo "done"
echo `date`