forked from ITHACA-FV/ITHACA-FV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
singularity-recipe.def
104 lines (71 loc) · 2.83 KB
/
singularity-recipe.def
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Bootstrap: docker
From: opencfd/openfoam2106-dev
Stage: build
%environment
of_var="source /usr/lib/openfoam/openfoam2106/etc/bashrc"
ithaca_var="source /usr/lib/ITHACA-FV/etc/bashrc"
export of_var ithaca_var
%post
#Define variables
USER="ithacafv"
of_var="source /usr/lib/openfoam/openfoam2106/etc/bashrc"
ithaca_var="source /usr/lib/ITHACA-FV/etc/bashrc"
# Create the user
cd ~
adduser --disabled-password --gecos '' $USER && \
adduser $USER sudo; echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
usermod -a -G $USER $USER && \
userdel sudofoam && \
usermod -u 1000 ithacafv && \
groupmod -g 1000 ithacafv
cd /home/$USER
chown -R $USER:$USER /home/$USER
chown -R $USER:$USER /home/openfoam && rm -r /home/openfoam && \
chown -R $USER:$USER /home/sudofoam && rm -r /home/sudofoam
#install necessary packages
cd ~
sudo apt-get update
sudo apt-get install git -y
sudo apt-get install vim -y
#get the lastest version of ITHACA-FV
cd /usr/lib/
git clone https://github.com/mathLab/ITHACA-FV.git
#install ITHACA-FV
/bin/bash -c "source /usr/lib/openfoam/openfoam2106/etc/bashrc && \
cd ITHACA-FV && git submodule update --init && source /etc/bash.bashrc && \
./Allwmake -tau -j 4 && \
cd ~ && \
cp -r /root/OpenFOAM/-v2106/platforms/linux64GccDPInt32Opt/bin/* /bin/ &&\
cp -r /root/OpenFOAM/-v2106/platforms/linux64GccDPInt32Opt/lib/* /lib/"
#Update bashrc
echo $of_var >> /etc/bash.bashrc
echo $ithaca_var >> /etc/bash.bashrc
#source bashrc
/bin/bash -c "source /etc/bash.bashrc"
%runscript
/bin/bash -c "source /etc/bash.bashrc"
echo "singularity container for ithacafv with openfoam"
echo "to activate the openfoam environment use"
echo "source /usr/lib/openfoam/openfoam2106/etc/bashrc"
echo "to activate the openfoam and ithacafv environment use"
echo "source /etc/bash.bashrc"
%labels
Author Pavan Pranjivan Mehta, Email : pavan_pranjivan_mehta@alumni.brown.edu
Version v0.1
%help
This is a singularity container for ITHACA-FV.
Please note the openFoam version is as per the docker image : "opencfd/openfoam2106-dev".
Change the docker image in the ".def" file for a different openFoam version.
Source code : https://github.com/mathLab/ITHACA-FV.git
1. To run intertactively, use "run" or "shell",
singularity shell <image>
2. To run in batch mode, use "exec" / "run"
singularity exec <image> <command>
3. MPI over slurm binds itself, with "exec"
mpirun -n $n singularity exec <image> <command>
Other valid statements,
srun -n $n singularity exec <image> <command>
mpiexec -n $n singularity exec <image> <command>
4. Using MPI over non-slurm machine, you will need to pass "--bind" with path to MPI installation directory.
Author : Pavan Pranjivan Mehta
Email : pavan.mehta@sissa.it