Part 1 : Local container on laptop
This part will show how to use code-server container locally on a laptop.
First, let's get the container with apptainer :
apptainer pull docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latestOr with podman :
podman pull docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latestOr with docker :
docker pull gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latest
This will create a introduction_cpp_algorithms_alpine_micromamba_code_server_latest.sif file of 310 MB. It contains :
- All the lecture dependencies
- All the lecture examples
- A readme.md with link to the lecture content
- A code-server which allows to follow the lecture directly inside a browser
Let's create a build directory :
mkdir build
Now, we can start the container with apptainer :
apptainer run --bind build:/build --writable-tmpfs introduction_cpp_algorithms_alpine_micromamba_code_server_latest.sifOr with podman :
podman run --net=host --rm -it -p 8080:8080 docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latestOr with docker :
docker run --net=host --rm -it -p 8080:8080 gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latest
Then, we can connect to http://127.0.0.1:8080/**.If you connect for the first time, code-server will ask you a password which is writen inside a configuration file in your home. It will tell you where it gets the password from anyway.
You can get the configuration with the following command :
cat ~/.config/code-server/config.yaml
Now, you can follow the lecture. All the examples are stored in the Examples directory. We can check the SimpleDotProduct :
First, let's go into the /build directory :
cd /build
Then, we can call cmake :
cmake /home/jovyan/Examples/SimpleDotProduct
Then, we can compile :
make
Finally we call the executable :
./simple_dot_product
If you started the container with the option --writable-tmpfs, you can update the main.cpp, recompile it and see the changes in the result.
If you want to run a GPU lecture with apptainer :
apptainer run --nv --bind build:/build --writable-tmpfs introduction_cpp_algorithms_alpine_micromamba_code_server_latest.sifOr with podman :
podman run --gpus all --device=/dev/dri --net=host --rm -it -p 8080:8080 docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latestOr with docker :
docker run --gpus all --device=/dev/dri --net=host --rm -it -p 8080:8080 gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_cpp_algorithms/introduction_cpp_algorithms_alpine_micromamba_code_server:latest