2
2
Installing IPS on NERSC
3
3
=======================
4
4
5
- NERSC recommends the use of anaconda environments to mange python
5
+ NERSC recommends the use of anaconda environments to manage python
6
6
installs, see `Brief introduction to Python at NERSC
7
- <https://docs.nersc.gov/development/languages/python/overview/ > `_.
7
+ <https://docs.nersc.gov/development/languages/python> `_.
8
8
9
9
There is a conda environment already constructed and maintained for
10
10
the *atom * project created using the `shareable environment `_
11
- method. You can activate it by running ``source
12
- /global/common/software/atom/cori/ips-framework-new/bin/activate ``.
11
+ method. You can activate it and run IPS by:
12
+
13
+ .. code-block :: bash
14
+
15
+ module load python
16
+ source activate /global/common/software/atom/cori/ips-framework-new
17
+ ips.py --config=simulation.config --platform=platform.conf
13
18
14
19
Creating you own conda environment
15
20
----------------------------------
16
21
17
- This guide will go through creating a conda environment on NERSC
22
+ This guide will go through creating a conda environment on NERSC and
18
23
installing the IPS Framework using `Option 2: Module + source activate
19
24
<https://docs.nersc.gov/development/languages/python/nersc-python/#option-2-module-source-activate> `_
20
25
21
26
First, you need to load the python module, then create and activate a
22
27
new conda environment. This will create the conda environment in your
23
- home directory
28
+ home directory (`` $HOME/.conda/envs ``):
24
29
25
30
.. code-block :: bash
26
31
27
32
module load python
28
33
conda create --name my_ips_env python=3.8 # or any version of python >=3.6
29
34
source activate my_ips_env
30
35
31
- Next, get download the IPS Framework and install it into the conda
32
- environment
36
+ If you would like the same packages and versions in your conda
37
+ environment as found in the python modules on Cori, you can clone that
38
+ environment. In this case using ``python/3.7-anaconda-2019.10 ``.
39
+
40
+ .. code-block :: bash
41
+
42
+ module load python/3.7-anaconda-2019.10
43
+ conda create -n my_ips_env --clone base
44
+ source activate my_ips_env
45
+
46
+ Next, install IPS-Framework into the conda environment
33
47
34
48
.. code-block :: bash
35
49
36
- git clone https://github.com/HPC-SimTools/IPS-framework.git
37
- cd IPS-framework
38
50
python -m pip install ipsframework
39
51
40
52
To leave your environment
@@ -43,9 +55,9 @@ To leave your environment
43
55
44
56
conda deactivate
45
57
46
- The example below show how to select the newly create conda
47
- environment to run use , see `Running Python in a batch job
48
- <https://docs.nersc.gov/development/languages/python/overview/ #running-python-in-a-batch-job> `_
58
+ The example below shows how to select the newly create conda
59
+ environment in a batch script , see `Running Python in a batch job
60
+ <https://docs.nersc.gov/development/languages/python/#running-python-in-a-batch-job> `_
49
61
50
62
.. code-block :: bash
51
63
@@ -63,29 +75,25 @@ environment to run use, see `Running Python in a batch job
63
75
Creating a shareable environment on /global/common/software
64
76
-----------------------------------------------------------
65
77
66
- Creating an conda environment on /global/common/software is the
67
- recommend way to have one environment shared between many uses, this
68
- is covered by `Option 4a: Install your own Python without containers
69
- <https://docs.nersc.gov/development/languages/python/nersc-python/#option-4a-install-your-own-python-without-containers> `_.
70
- There may also be performance benefits to running from this location
71
- instead of your home directory.
78
+ By default when you create a conda environment it will be created in
79
+ ``$HOME/.conda/envs ``, to create one elsewhere that can be used by
80
+ others you can use the ``--prefix `` option, see `Creating conda
81
+ environments
82
+ <https://docs.nersc.gov/development/languages/python/nersc-python/#creating-conda-environments> `_.
72
83
73
- Following the instruction we do
84
+ In this example we are cloning the conda environment from the
85
+ ``python/3.7-anaconda-2019.10 `` module and install ``ipsframework ``.
74
86
75
87
.. code-block :: bash
76
88
77
- wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
78
- bash Miniconda3-latest-Linux-x86_64.sh -b -p /global/common/software/myproject/env
79
- source /global/common/software/myproject/env/bin/activate
80
-
81
- Then install IPS into the environment, from within the IPS-framework
82
- source directory::
83
-
89
+ module load python/3.7-anaconda-2019.10
90
+ conda create --prefix /global/common/software/myproject/env --clone base
91
+ source activate /global/common/software/myproject/env
84
92
python -m pip install ipsframework
85
93
86
- The example below show how to select the newly create conda
87
- environment to run use , see `Running Python in a batch job
88
- <https://docs.nersc.gov/development/languages/python/overview/ #running-python-in-a-batch-job> `_
94
+ The example below shows how to select the newly create conda
95
+ environment in you batch script , see `Running Python in a batch job
96
+ <https://docs.nersc.gov/development/languages/python/#running-python-in-a-batch-job> `_
89
97
90
98
.. code-block :: bash
91
99
@@ -94,10 +102,10 @@ environment to run use, see `Running Python in a batch job
94
102
# SBATCH --nodes=1
95
103
# SBATCH --time=5
96
104
97
- source /global/common/software/myproject/env/bin/activate
105
+ module load python
106
+ source activate /global/common/software/myproject/env
98
107
ips.py --config=simulation.config --platform=platform.conf
99
108
100
-
101
109
Installing dependencies
102
110
~~~~~~~~~~~~~~~~~~~~~~~
103
111
@@ -107,92 +115,27 @@ To see which packages are currently install in your environment run:
107
115
108
116
conda list
109
117
110
- You can install just the dependencies you need by
111
-
112
- .. code-block :: bash
113
-
114
- conda install matplotlib netcdf4 ...
115
-
116
- If you would like the same versions and dependencies in your conda
117
- environment as found in the python modules on Cori, you can export
118
- that environment and set your environment to be the same.
119
-
120
- Export ``python/3.7-anaconda-2019.10 `` to yml file.
121
-
122
- .. code-block :: bash
123
-
124
- module load python/3.7-anaconda-2019.10
125
- conda env export --name base > environment.yml
126
-
127
- # remove mpi4py and buildtest from environment.yml as these should be installed manually
128
- sed -i ' /mpi4py/d' environment.yml
129
- sed -i ' /buildtest/d' environment.yml
130
-
131
- Activate your conda environment and force it to match the
132
- ``environment.yml `` file. ``mpi4py `` should be install separately
133
- `according to NERSC
134
- <https://docs.nersc.gov/development/languages/python/parallel-python/#mpi4py-in-your-custom-conda-environment> `_.
118
+ You can install any other dependencies you need by
135
119
136
120
.. code-block :: bash
137
121
138
- source activate my_ips_env
139
- conda env update -n my_ips_env --file environment.yml
140
-
141
- # or
142
-
143
- source /global/common/software/myproject/env/bin/activate # your environment
144
- # setup base environment
145
- conda env update -n base --file environment.yml
146
-
147
- Install ``mpi4py `` if needed
148
-
149
- .. code-block :: bash
150
-
151
- MPICC=" $( which cc) --shared" python -m pip install --no-binary mpi4py mpi4py
152
-
153
- Alternatively you can start with the same Anaconda environment which
154
- will have almost everything you need already and then just install the
155
- few missing dependencies. As an example, this use the same Anaconda
156
- distribution as in the ``python/3.7-anaconda-2019.10 `` module.
157
-
158
- .. code-block :: bash
159
-
160
- wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
161
- bash Anaconda3-2019.10-Linux-x86_64.sh -b -p /global/common/software/myproject/env
162
- source /global/common/software/myproject/env
163
- conda install netcdf4
164
- MPICC=" $( which cc) --shared" python -m pip install --no-binary mpi4py mpi4py
165
- python -m pip install dask-mpi
122
+ conda install numpy matplotlib netcdf4 ...
166
123
167
124
User development
168
125
~~~~~~~~~~~~~~~~
169
126
170
- Miniconda or Anaconda can can be installed to your home directory for easy development of component wrappers.
171
-
172
- .. code-block :: bash
173
-
174
- wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
175
- bash Anaconda3-2019.10-Linux-x86_64.sh -b -p $HOME /anaconda3
176
- source $HOME /anaconda3/bin/activate
177
- conda install netcdf4
178
- MPICC=" $( which cc) --shared" python -m pip install --no-binary mpi4py mpi4py
179
- python -m pip install dask-mpi
180
- python -m pip install ipsframework
181
-
182
-
183
- After which you can switch between youy development and the production
184
- environment on atom project by
127
+ You should keep your development environment separate from the
128
+ production environment. If you do development in your ``my_ips_env ``
129
+ conda environment you can switch between that and the production
130
+ environment on the atom project by
185
131
186
132
.. code-block :: bash
187
133
188
134
# switch to production environment
189
- source /global/common/software/atom/cori/ips-framework-new/bin/activate
135
+ source activate /global/common/software/atom/cori/ips-framework-new
190
136
191
137
# switch bask to user development environment
192
- source $HOME /miniconda3/bin/activate
193
-
194
- To see which environment you are currently in you can run
195
-
196
- .. code-block :: bash
138
+ source activate my_ips_env
197
139
198
- conda env list
140
+ Your bash prompt should be updated to reflect which environment you
141
+ have active.
0 commit comments