Skip to content

Commit 8082285

Browse files
committed
init installation guide for Server/ Cluster
1 parent f9dd6d2 commit 8082285

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

doc/source/install_cluster.rst

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
.. _Installation_EULER:
2+
3+
Installation on a server / the Euler Cluster (ETH internal)
4+
************
5+
6+
Please execute the instructions of the following text boxes in a Terminal.
7+
For ETH WCR group members, there are two directories that can be used for the installation:
8+
1. "Home": /cluster/home/USERNAME/
9+
2. "Work": /cluster/work/climate/USERNAME
10+
The advantage of using "Home" is that it is the location with the fastest access for the use python and CLIMADA.
11+
The disadvantage of "Home" is the limited quota of 20 GB and 100'000 files, since both miniconda and CLIMADA come with many single files.
12+
If you don't have many other files stored in "Home", (1) is the recommended option. Otherwise got for (2)
13+
14+
For all steps listed below, first enter the Cluster via SSH.
15+
16+
On the server, go to either your "Home" or your "Work" environment. In the following we will go for option (2) and install everything in the "Work" path.
17+
If you are using a different server or option, please customise the paths in each step.
18+
19+
cd /cluster/work/climate/USERNAME
20+
21+
Download
22+
========
23+
**Version in development**: Download or clone the GitHub repository `climada_python <https://github.com/CLIMADA-project/climada_python.git>`_.
24+
25+
To clone the repository, you need to first `install git <https://www.linode.com/docs/development/version-control/how-to-install-git-on-linux-mac-and-windows/>`_.
26+
Afterwards you can use the following command line with climada_python's URL::
27+
28+
git clone https://github.com/CLIMADA-project/climada_python.git
29+
30+
31+
Unix Operating System
32+
=====================
33+
34+
35+
Install environment with Miniconda
36+
----------------------------------
37+
1. **Miniconda**: Download or update to the latest version of `Miniconda <https://conda.io/miniconda.html>`_. You can do so by following these steps
38+
(using wget to download miniconda installation file: https://conda.io/en/latest/miniconda.html, Python 3.7, LINUX, 64bit)::
39+
40+
cd /cluster/work/climate/USERNAME
41+
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
42+
bash Miniconda3-latest-Linux-x86_64.sh
43+
rm Miniconda3-latest-Linux-x86_64.sh
44+
cd climada_python
45+
conda env create -f requirements/env_climada.yml --name climada_env
46+
47+
During the installation process of Miniconda, you are prompted to set the working directory according to your choice.
48+
49+
2. **Install dependencies**: Create the virtual environment *climada_env* with climada's dependencies::
50+
51+
conda env create -f requirements/env_climada.yml --name climada_env
52+
53+
To include *climada_python* in the environment's path, do the following. In your environments folder, for example /cluster/work/climate/USERNAME/miniconda3/*::
54+
55+
cd envs/climada_env/lib/python3.6/site-packages
56+
echo '/your/path/to/climada_python/' > climada_env_path.pth
57+
58+
3. **Test installation**: Activate the environment, execute the unit tests and deactivate the environment when finished using climada::
59+
60+
source activate climada_env
61+
python3 tests_runner.py
62+
source deactivate
63+
64+
If the installation has been successful, an OK will appear at the end of the execution.
65+
Warning: Executing the whole test_runner takes pretty long and downloads some files to climada_python/data that you might not need.
66+
Consider aborting the test once you see first "OK"s in the output.
67+
68+
4. **Submit a test BJOB to the queue of the cluster**: Write a shell script that initiates the Python environment climada_env and submit the job::
69+
70+
touch run_climada_python.sh
71+
echo "#!/bin/sh" > run_climada_python.sh
72+
echo "cd /cluster/work/climate/USERNAME/climada_python" >> run_climada_python.sh
73+
echo "source activate climada_env" >> run_climada_python.sh
74+
echo "python3 script/tutorial/climada_hazard_drought.py" >> run_climada_python.sh
75+
echo "conda deactivate" >> run_climada_python.sh
76+
echo "echo script completed" >> run_climada_python.sh
77+
chmod 755 run_climada_python.sh
78+
bsub -J "test01" -W 1:00 -R "rusage[mem=5120]" -oo logs/test01.txt -eo logs/e_test01.txt < run_climada_python.sh
79+
80+
81+
82+
Notes:
83+
- Change the script after echo "python3" to the path of the Python script you want to execute.
84+
- Change the working path to the path you have cloned the climada_python repository to.
85+
- Customise the bsub options accordingly
86+
87+
88+
89+
Update climada's environment
90+
----------------------------
91+
Before using climada's code in development, remember to update your code as well as climada's environment. The requirements in ``requirements/env_developer.yml`` contain all the packages which are necessary to execute the continuous integration of climada. These can be therefore useful for climada's contributors.
92+
93+
If you use conda, you might use the following commands to update the environments::
94+
95+
cd climada_python
96+
git pull
97+
source activate climada_env
98+
conda env update --file requirements/env_climada.yml
99+
conda env update --file requirements/env_developer.yml
100+
101+
If any problem occurs during this process, consider reinstalling everything from scratch following the `Installation`_ instructions.
102+
You can find more information about virtual environments with conda `here <https://conda.io/docs/user-guide/tasks/manage-environments.html>`_.
103+

0 commit comments

Comments
 (0)