Skip to content

Commit 237ec6f

Browse files
committed
condor
1 parent 58c0b05 commit 237ec6f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

content/guides/condor.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: "Running MESA on Condor"
3+
date: 2017-02-16T10:49:28-04:00
4+
author: Earl Bellinger
5+
draft: false
6+
---
7+
8+
Active condor user here. I wrote a script called `maybe_sub.sh` that submits jobs to condor to run in parallel if condor is available (hence 'maybe'). You can see it here:
9+
[https://github.com/earlbellinger/asteroseismology/blob/master/scripts/maybe_sub.sh](https://github.com/earlbellinger/asteroseismology/blob/master/scripts/maybe_sub.sh)
10+
11+
You can do something like:
12+
13+
```bash
14+
maybe_sub.sh -p 8 echo hi
15+
```
16+
17+
which will execute `echo hi` using 8 processors on the cluster. In addition to running the program on the cluster as normal, it will create a directory called `maybe_sub_logs` which inside details the outputs of the calculation ("hi"). You can run `maybe_sub.sh -h` to see all the options.
18+
19+
*I personally drop this file in a `~/scripts` directory, make it executable (`chmod +x maybe_sub.sh`), and add `~/scripts` to my `$PATH` variable in my `.bashrc` file so that I can call it from anywhere.*
20+
21+
My workflow is to write a simple bash script for setting up my MESA job and then use `maybe_sub.sh` to execute that bash script optionally in parallel using the `-p` argument to specify the number of processors. The trick with MESA+condor is to send along the `$OMP_NUM_THREADS` variable to condor.
22+
23+
For example, in our recent paper [1], I made a quasirandom grid of main-sequence solar-like oscillators. For each combination of mass, metallicity, etc., I called a bash script called `dispatch.sh` which can be seen here:
24+
[https://github.com/earlbellinger/asteroseismology/blob/master/forward/dispatch.sh](https://github.com/earlbellinger/asteroseismology/blob/master/forward/dispatch.sh)
25+
26+
On the compute nodes, it copies over my "mesa template," changes the inlist settings to the desired properties, and runs the track in parallel. This would be called, for example, with:
27+
28+
```bash
29+
maybe_sub.sh -p 4 dispatch.sh -M 1.2 -Z 0.001
30+
```
31+
32+
to run a track with a mass of 1.2 and a metallicity of 0.001 using 4 processors.
33+
34+
To make a grid, I have a Python program called `sobol_dispatcher.py`:
35+
[https://github.com/earlbellinger/asteroseismology/blob/master/forward/sobol_dispatcher.py](https://github.com/earlbellinger/asteroseismology/blob/master/forward/sobol_dispatcher.py)
36+
37+
which calls `maybe_sub.sh` on `dispatch.sh` with varied arguments, with something like:
38+
39+
```python
40+
bash_cmd = "maybe_sub.sh -p 2 ./dispatch.sh -M 0.9"
41+
subprocess.Popen(bash_cmd.split(), shell=False)
42+
```
43+
44+
You can write your own script (which I personally find good to do for each individual project at hand) or link up `maybe_sub.sh` to one of the existing MESA scripts.
45+
46+
Hope this is helpful.
47+
48+
[1] Earl P. Bellinger & George C. Angelou et al., "Fundamental Parameters of Main-Sequence Stars in an Instant with Machine Learning," 2016 ApJ 830 31,
49+
[http://adsabs.harvard.edu/abs/2016ApJ...830...31B](http://adsabs.harvard.edu/abs/2016ApJ...830...31B)
50+
51+
Best regards,
52+
Earl Bellinger

0 commit comments

Comments
 (0)