Yambo via Docker: Difference between revisions

From The Yambo Project
Jump to navigation Jump to search
(Copy and paste from previous school)
 
No edit summary
 
(12 intermediate revisions by one other user not shown)
Line 2: Line 2:
An alternative to get the Yambo code is to install the Yambo container in your machine and this can be done in few steps:
An alternative to get the Yambo code is to install the Yambo container in your machine and this can be done in few steps:


* Install the docker platform (Linux or Mac). Follow the instruction in the docker [https://docs.docker.com/engine/install/ website].
* Install the docker platform (Linux or Mac). Follow the instruction in the docker [https://docs.docker.com/engine/install/ website].
* Pull the Yambo container:


  sudo docker pull nicspalla/yambo-gcc_openmp_petsc:latest
It is possible to run Docker by a normal user without the sudo privileges. In order to do that, you have to add your username to the group "docker" (suggested on Linux!).  
 
sudo it is not necessary if your user is part of the group named docker (suggested on Linux!).


For Linux users:
For Linux users:
Line 19: Line 16:
   sudo dseditgroup -o edit -a $USER -t user docker
   sudo dseditgroup -o edit -a $USER -t user docker


Log out and log back in so that your group membership is re-evaluated.
Log out and log back in so that your group membership is re-evaluated.  
 
If you you prefer to use sudo please remember to add the "sudo" command before all the commands below.
 
* Download the script file "[https://raw.githubusercontent.com/nicspalla/yambo-containers/main/drun drun]" that will help you to hide the many options needed by the container:
 
wget https://raw.githubusercontent.com/nicspalla/yambo-containers/main/drun


* You are done. To run Yambo into the container:
then give the file execute privileges:


  docker run -ti --user $(id -u):$(id -g) \
  chmod +x drun
    --mount type=bind,source="$(pwd)",target=/tmpdir \
    -e OMP_NUM_THREADS=4  \
    nicspalla/yambo-gcc_openmp_petsc:latest \
    yambo -F yambo.in -J yambo.out


Otherwise (suggested!), copy and paste the code below in a file, i.e called drun.sh:
Move (or copy) this file in the directory where you want to use Yambo and use it as prefix of your Yambo calculation.


#!/bin/bash
* First you have to initialize the environment needed by the container:
docker run -ti --user $(id -u):$(id -g) \
    --mount type=bind,source="$(pwd)",target=/tmpdir \
    -e OMP_NUM_THREADS=4  \
    nicspalla/yambo-gcc_openmp_petsc:latest $@


then give the file execute privileges:
./drun -i
 
this command will pull the container (needs ~1.8GB in your filesystem) if not already done and will create a file named env.txt needed by the container to run Yambo.


chmod +x drun.sh
* Now you can run yambo like in this example:


Move (or copy) this file in the directory where you want to use Yambo and use it as prefix of your Yambo calculation:
./drun yambo -F yambo.in -J yambo.out


./drun.sh yambo -F yambo.in -J yambo.out
These are the options of the script drun:


If the yambo container is working correctly you should obtain:
-i                # container initialization
-np N              # Number of MPI tasks for a parallel run (default 0, i.e. serial run)
-t N              # Number of threads per process/task (default 1)
--env-file FILE    # set the path of an environment file (default ./env.txt)
-c IMAGE:TAG      # set the name and tag of the container image (default maxcentre/yambo:5.1.0_gcc9)


./drun.sh yambo
If the yambo container is working correctly this command
yambo: cannot access CORE database (SAVE/*db1 and/or SAVE/*wf)


  ./drun.sh yambo -h
  ./drun yambo -h


should provide in output the help for yambo usage.
should provide in output the help for yambo usage.
* To delete the container images downloaded, you can use this command:
docker image rm <image_name>
To remove all the stopped containers, use this command:
docker system prune

Latest revision as of 09:36, 23 February 2024

An alternative to get the Yambo code is to install the Yambo container in your machine and this can be done in few steps:

  • Install the docker platform (Linux or Mac). Follow the instruction in the docker website.

It is possible to run Docker by a normal user without the sudo privileges. In order to do that, you have to add your username to the group "docker" (suggested on Linux!).

For Linux users:

 sudo groupadd docker
 sudo usermod -aG docker $USER

For Mac users:

 sudo dscl . create /Groups/docker
 sudo dseditgroup -o edit -a $USER -t user docker

Log out and log back in so that your group membership is re-evaluated.

If you you prefer to use sudo please remember to add the "sudo" command before all the commands below.

  • Download the script file "drun" that will help you to hide the many options needed by the container:
wget https://raw.githubusercontent.com/nicspalla/yambo-containers/main/drun

then give the file execute privileges:

chmod +x drun

Move (or copy) this file in the directory where you want to use Yambo and use it as prefix of your Yambo calculation.

  • First you have to initialize the environment needed by the container:
./drun -i

this command will pull the container (needs ~1.8GB in your filesystem) if not already done and will create a file named env.txt needed by the container to run Yambo.

  • Now you can run yambo like in this example:
./drun yambo -F yambo.in -J yambo.out

These are the options of the script drun:

-i                 # container initialization
-np N              # Number of MPI tasks for a parallel run (default 0, i.e. serial run)
-t N               # Number of threads per process/task (default 1)
--env-file FILE    # set the path of an environment file (default ./env.txt)
-c IMAGE:TAG       # set the name and tag of the container image (default maxcentre/yambo:5.1.0_gcc9)

If the yambo container is working correctly this command

./drun yambo -h

should provide in output the help for yambo usage.

  • To delete the container images downloaded, you can use this command:
docker image rm <image_name>

To remove all the stopped containers, use this command:

docker system prune