Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| caffe_singularity [2017/07/13 12:10] – créée admin | caffe_singularity [2017/07/13 18:00] (Version actuelle) – [Install or (bootsrap) the container the image] admin | ||
|---|---|---|---|
| Ligne 13: | Ligne 13: | ||
| The image can be created with this commande: | The image can be created with this commande: | ||
| - | <code > | + | < |
| $ sudo create -size 2048 caffe-cpu.img | $ sudo create -size 2048 caffe-cpu.img | ||
| </ | </ | ||
| + | |||
| + | This command will create a file named '' | ||
| + | |||
| + | |||
| ===== Install or (bootsrap) the container the image ===== | ===== Install or (bootsrap) the container the image ===== | ||
| + | |||
| + | Next, we need install system (ubuntu), all required softwares and finally caffe. | ||
| + | |||
| + | The Bootsrap file is given bellow: | ||
| + | |||
| + | <file bash Singularity> | ||
| + | |||
| + | BootStrap: docker | ||
| + | From: ubuntu: | ||
| + | |||
| + | %setup | ||
| + | # commands to be executed on host outside container during bootstrap | ||
| + | |||
| + | %post | ||
| + | # commands to be executed inside container during bootstrap | ||
| + | |||
| + | # create bind points for MesoFC HPC environment | ||
| + | mkdir -p /Work | ||
| + | mkdir -p /Home | ||
| + | |||
| + | ### Install depencies applications | ||
| + | apt-get update && apt-get install -y --no-install-recommends \ | ||
| + | build-essential \ | ||
| + | cmake \ | ||
| + | git \ | ||
| + | wget \ | ||
| + | libatlas-base-dev \ | ||
| + | libboost-all-dev \ | ||
| + | libgflags-dev \ | ||
| + | libgoogle-glog-dev \ | ||
| + | libhdf5-serial-dev \ | ||
| + | libleveldb-dev \ | ||
| + | liblmdb-dev \ | ||
| + | libopencv-dev \ | ||
| + | libprotobuf-dev \ | ||
| + | libsnappy-dev \ | ||
| + | protobuf-compiler \ | ||
| + | python-dev \ | ||
| + | python-numpy \ | ||
| + | python-pip \ | ||
| + | python-setuptools \ | ||
| + | python-scipy && \ | ||
| + | #rm -rf / | ||
| + | |||
| + | ### Install caffe in /opt | ||
| + | cd /opt | ||
| + | |||
| + | git clone https:// | ||
| + | cd caffe && pip install --upgrade pip && \ | ||
| + | cd python && pip install -r requirements.txt&& | ||
| + | cd ..&& | ||
| + | cmake -DCPU_ONLY=1 .. && \ | ||
| + | make -j" | ||
| + | |||
| + | |||
| + | ### update environement variable | ||
| + | cd | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | echo " | ||
| + | |||
| + | echo " | ||
| + | ln -s / | ||
| + | |||
| + | %runscript | ||
| + | # commands to be executed when the container runs | ||
| + | |||
| + | %test | ||
| + | # commands to be executed within container at close of bootstrap process | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | The command to use is: | ||
| + | |||
| + | <code bash> | ||
| + | $ sudo singularity bootstrap caffe-cpu.img Singularity | ||
| + | </ | ||
| + | |||
| + | Where | ||
| + | * caffe-cpu.img: | ||
| + | * Singularity: | ||
| + | |||
| + | This will take some minutes (take a coffee). | ||
| + | |||
| + | If all goes well, caffe is installed by success inside the container '' | ||
| + | |||
| + | |||
| + | ===== Use the container ===== | ||
| + | |||
| + | You can run caffe, in your host, inside the container: | ||
| + | |||
| + | <code bash> | ||
| + | $ singularity exec caffe-cpu.img caffe | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Use the build container on the Mesocentre ===== | ||
| + | |||
| + | Just copy this file to your cluster account ('' | ||
| + | |||
| + | For example for interactive usage: | ||
| + | |||
| + | <code bash> | ||
| + | $ qlogin -lh_vmem=6G | ||
| + | </ | ||
| + | |||
| + | |||
| + | <code bash> | ||
| + | $ cd WORK | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | $ module load tools/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | <code bash> | ||
| + | $ singularity exec caffe-cpu.img caffe | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ====== Links ====== | ||
| + | |||
| + | * [[caffe|Caffe Optimized for GPU]] | ||
| + | |||