compile.sh 4.81 KB
Newer Older
Cedric Jourdain's avatar
Cedric Jourdain committed
1
2
3
4
5
6
#!/bin/bash

echo "==> Choose supercomputer :"
echo "     - occigen"
echo "     - marenostrum "
echo "     - marconi-knl "
7
echo "     - daint-gpu "
Cedric Jourdain's avatar
Cedric Jourdain committed
8
echo "     - daint-cpu-only "
Cedric Jourdain's avatar
Cedric Jourdain committed
9
echo "     - davide "
Cedric Jourdain's avatar
Cedric Jourdain committed
10
echo "     - juwels"
11
12
echo "     - irene-skl "
echo "     - irene-knl "
13
echo "     - dibona "
14
echo "     - frioul "
15
16
echo "     - deepsdv "
echo "     - hazelhen  "
Cedric Jourdain's avatar
Cedric Jourdain committed
17
18
19
20
21
22
23
24
25
26
read machine

source ./env/env_${machine}

Untar(){
    echo "==> Untar "
    #Clone the repository
    cd $install_dir
    git -c http.sslVerify=false clone  https://github.com/geodynamics/specfem3d_globe.git
    cd specfem3d_globe/
Cedric Jourdain's avatar
Cedric Jourdain committed
27
    # Checkout of 31 ocotbre 2017 version
Cedric Jourdain's avatar
Cedric Jourdain committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    git checkout b1d6ba966496f269611eff8c2cf1f22bcdac2bd9

    #Copy sources
    #source_dir=$HOME/git/specfem3d_globe
    #echo "Copy source"
    #cp -r $source_dir $install_dir
    cd $ueabs_dir
}

Install(){
    echo "===>  Configure "
    answer=0
    echo "1. Test Case A is designed to run on Tier-1 sized systems (up to around 1,000 x86 cores, or equivalent)"
    echo "2. Test Case B is designed to run on Tier-0 sized systems (up to around 10,000 x86 cores, or equivalent)"
Cedric Jourdain's avatar
Cedric Jourdain committed
42
    echo "3. Test Case C is designed to run on 1 or 2 node(s)"
Cedric Jourdain's avatar
Cedric Jourdain committed
43
44
    while true
    do
Cedric Jourdain's avatar
Cedric Jourdain committed
45
        echo "===> Choose Test Case : (1, 2 or 3)"
Cedric Jourdain's avatar
Cedric Jourdain committed
46
        read answer
Cedric Jourdain's avatar
Cedric Jourdain committed
47
        if [[ $answer -eq 1 || $answer -eq 2 || $answer -eq 3 ]]; then break;fi
Cedric Jourdain's avatar
Cedric Jourdain committed
48
49
50
    done
    if [ $answer = "1" ]; then
        echo "===> Copy test case A"
51
52
53
54
        tar zxvf $HOME/tarballs/SPECFEM3D_TestCaseA.tar.gz
	export install_dir=$install_dir/TestCaseA
	mkdir -p $install_dir
	mv $install_dir/../specfem3d_globe  $install_dir/.
Cedric Jourdain's avatar
Cedric Jourdain committed
55
56
        cp SPECFEM3D_TestCaseA/* $install_dir/specfem3d_globe/DATA/.
        rm -rf SPECFEM3D_TestCaseA
Cedric Jourdain's avatar
Cedric Jourdain committed
57
    elif [ $answer = "2" ]; then
Cedric Jourdain's avatar
Cedric Jourdain committed
58
        echo "===> Copy test case B"
59
60
61
62
	export install_dir=$install_dir/TestCaseB
	mkdir -p $install_dir
	mv $install_dir/../specfem3d_globe  $install_dir/.
        tar zxvf $HOME/tarballs/SPECFEM3D_TestCaseB.tar.gz
Cedric Jourdain's avatar
Cedric Jourdain committed
63
64
        cp SPECFEM3D_TestCaseB/* $install_dir/specfem3d_globe/DATA/.
        rm -rf SPECFEM3D_TestCaseB
Cedric Jourdain's avatar
Cedric Jourdain committed
65
66
67
68
69
70
71
    else
	echo "===> Copy test case C"
        export install_dir=$install_dir/TestCaseC
        mkdir -p $install_dir
        mv $install_dir/../specfem3d_globe  $install_dir/.
        cp $ueabs_dir/test_cases/SPECFEM3D_TestCaseC/* $install_dir/specfem3d_globe/DATA/.

Cedric Jourdain's avatar
Cedric Jourdain committed
72
73
    fi
    cd $install_dir/specfem3d_globe
Cedric Jourdain's avatar
Cedric Jourdain committed
74
    if [ $machine = "daint-gpu" ] || [ $machine = "davide" ]; then
75
76
77
78
79
80
	echo "Configure for CPU+GPU system"
	### replace `use mpi` if needed ###
	#cd utils
 	#perl replace_use_mpi_with_include_mpif_dot_h.pl
 	#cd ..
	sed -i s/"GPU_MODE                        = .false."/"GPU_MODE                        = .true."/g  $install_dir/specfem3d_globe/DATA/Par_file
Cedric Jourdain's avatar
Cedric Jourdain committed
81
82
83
84
85
	if [ $machine = "daint-gpu" ];then
		export MPI_INC=$MPICH_DIR/include
		export CUDA_LIB="$CUDATOOLKIT_HOME/lib64"
		export CUDA_INC="$CUDATOOLKIT_HOME/include"
	fi
86
87
88
89
90
	./configure --build=ppc64 --with-cuda=cuda5
    else
	echo "Configure for CPU only system"
        ./configure  --enable-openmp
    fi
Cedric Jourdain's avatar
Cedric Jourdain committed
91
92
93
94
95
96
97
98
99
    echo $machine
    #if [ $machine = "occigen" ] || [ $machine = "marenostrum" ] || [ $machine = "marconi-knl" ];then
    #    echo "===> Edit Par_file (MemPerCor=50... )"
    #    sed -i s/"MEMORY_INSTALLED_PER_CORE_IN_GB = 2.5d0"/"MEMORY_INSTALLED_PER_CORE_IN_GB = 50d0"/g DATA/Par_file
    #fi
    echo "===> Build"
    time -p make -j 12 all >& make.log &
}

Cedric Jourdain's avatar
Cedric Jourdain committed
100
101
102
Clean(){
	if [ ! -z "$install_dir" ] && [ -d $install_dir ];then
		echo "==> Clean installation directory"
Cedric Jourdain's avatar
Cedric Jourdain committed
103
		answer=0
Cedric Jourdain's avatar
Cedric Jourdain committed
104
		while true
Cedric Jourdain's avatar
Cedric Jourdain committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
                do
                    echo "===> Choose Test Case to delete : (1, 2, 3)"
                    echo "1 : $install_dir/TestCaseA"
                    echo "2 : $install_dir/TestCaseB"
                    echo "3 : $install_dir/TestCaseC"
                    read answer
                    if [[ $answer -eq 1 || $answer -eq 2 || $answer -eq 3 ]]; then break;fi
                done
                if [ $answer = "1" ]; then
                        rm -rf $install_dir/TestCaseA
                elif [ $answer = "2" ]; then
                        rm -rf $install_dir/TestCaseB
                else
                        rm -rf $install_dir/TestCaseC
                fi
Cedric Jourdain's avatar
Cedric Jourdain committed
120
121
122
123
124
125
	else
		echo "Error with install_dir variable"
		exit
	fi
}

Cedric Jourdain's avatar
Cedric Jourdain committed
126
127
Deploy(){
    echo "install_dir ="$install_dir
128
    if [ $machine = "occigen" ] || [ $machine = "marenostrum" ] || [ $machine = "marconi-knl" ] || [ $machine = "daint-cpu-only" ] || [ $machine = "daint-gpu" ]  || [ $machine = "davide" ] || [ $machine = "juwels" ] || [ $machine = "irene-skl" ] || [ $machine = "irene-knl" ] || [ $machine = "dibona" ] || [ $machine = "frioul" ]  || [ $machine = "deepsdv" ] || [ $machine = "hazelhen" ];then
Cedric Jourdain's avatar
Cedric Jourdain committed
129
        echo "==> Install on $machine :"
Cedric Jourdain's avatar
Cedric Jourdain committed
130
	mkdir -p $install_dir
131
	Clean
Cedric Jourdain's avatar
Cedric Jourdain committed
132
        export ueabs_dir=`pwd`
Cedric Jourdain's avatar
Cedric Jourdain committed
133
        Untar
Cedric Jourdain's avatar
Cedric Jourdain committed
134
135
136
137
138
139
140
141
        Install
    else
        echo "Wrong machine !"
        exit
    fi
}

Deploy