Clone or download the project. Open a terminal in this folder.
Run
docker build -t my-gcc-app .
to build the docker. It will automatically install MPI.
Run docker. It will share the current folder with the docker instance in /host
: put your code here.
docker run -it -v "$PWD":/host my-gcc-app
Then go in the shared folder:
cd /host
If you do not choose the name of your output file, it will be by default a.out
mpic++ <name of your cpp file>
To choose your output file : (-o
allows you to specifiy your output file )
mpic++ -o <name of output file> <name of your cpp file>
mpirun --allow-run-as-root ./a.out
or mpirun --allow-run-as-root <name of output file>
(because you are root on docker) TODO : create user and give correct permissions etc.
To run with multiple threads :
mpirun --allow-run-as-root -n 4 ./a.out
or mpirun --allow-run-as-root <name of output file>
g++ -fopenmp <name of your cpp file>
then
./a.out