Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hpc parameter+ #53

Open
wants to merge 52 commits into
base: casa6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
307523e
Cluster addition: Galahad
mb010 Mar 31, 2021
1515785
Merge remote-tracking branch 'mb010/Galahad_adaptations' into HPC_par…
mb010 Jun 29, 2021
e249690
Merge remote-tracking branch 'origin/casa6' into HPC_parameter
mb010 Oct 1, 2021
70b5272
Ignoring venv
mb010 Oct 4, 2021
f66adf3
Move HPC params to DEFAULTS
mb010 Oct 4, 2021
0f64df1
Removing globals from function definitions and cleaning DEFAULTS.cfg
mb010 Oct 4, 2021
7406bac
HPC specific SBATCH file header implementation.
mb010 Oct 4, 2021
310724d
Renamed known_hpc.cfg
mb010 Oct 4, 2021
1974798
Adding unknown HPC limits.
mb010 Oct 5, 2021
6d03659
Fixing global access to defaults.
mb010 Oct 5, 2021
4030cba
Intermittent Argparse to set default HPC values. Including bug fixes …
mb010 Oct 5, 2021
f19dbec
Adjusting default parameters
mb010 Oct 13, 2021
bd80a5a
Processing known HPC Params
mb010 Oct 13, 2021
f98309b
Global params adaptation
mb010 Oct 13, 2021
7ae1ddb
SPW pipeline run construction
mb010 Oct 13, 2021
cd16a5e
Merge branch 'HPC_parameter' into mb010/HPC_parameter
mb010 Oct 13, 2021
66f748a
Merge remote-tracking branch 'origin/casa6' into HPC_parameter
mb010 Oct 26, 2021
377f269
Merge remote-tracking branch 'origin/casa6' into HPC_parameter
mb010 Nov 9, 2021
c193c11
Minor bug fix
mb010 Nov 9, 2021
17e92f2
More robust environment adjustment
mb010 Nov 9, 2021
0f8e8e0
Maintain cli
mb010 Nov 9, 2021
29fd36e
Galahad specific mpi call change
mb010 Nov 11, 2021
48c45c0
Bug fix: recursive CLI calls
mb010 Nov 11, 2021
a4ac6dd
Reintroduce global script paths
mb010 Nov 11, 2021
749e5be
Saving HPC parameter
mb010 Nov 11, 2021
6c91c76
Path correction to allow relative imports
mb010 Nov 11, 2021
ef50150
Minor change to remove additional dependancy.
mb010 Nov 11, 2021
30b31c3
Removing global dependency
mb010 Nov 11, 2021
85a5cb4
typo
mb010 Nov 11, 2021
fdf07e8
Add petrichor
AlecThomson Jan 31, 2022
ae4fc5f
Fix parsing
AlecThomson Jan 31, 2022
0c2e998
Fix missing kwargs
AlecThomson Jan 31, 2022
a274294
Ignore
AlecThomson Jan 31, 2022
d6cdf88
Capital C bug
AlecThomson Feb 4, 2022
8b3afbe
Fix argument logic
AlecThomson Feb 4, 2022
15e0091
Merge pull request #1 from AlecThomson/HPC_parameter
mb010 Apr 28, 2022
eb9246d
Merge branch 'HPC_parameter' of https://github.com/mb010/pipelines in…
AlecThomson Jul 2, 2022
23cbf8b
Add spw prefix
AlecThomson Jul 2, 2022
767e6a7
Fix overdetermined args
AlecThomson Jul 2, 2022
eb4aacd
Typo
AlecThomson Jul 2, 2022
d5d900e
Merge pull request #2 from AlecThomson/fix
mb010 Jul 6, 2022
b13e131
Check for HPC in config
AlecThomson Jul 8, 2022
6d088be
Update petrichor
AlecThomson Jul 8, 2022
41f4d0a
Merge pull request #3 from AlecThomson/fix
mb010 Jul 8, 2022
9985626
Merge pull request #55 from idia-astro/casa6
Kitchi Aug 16, 2022
25cf6ba
Updated README.md
Kitchi Aug 16, 2022
6f135f0
Fix broken docs link in README
Jordatious Aug 16, 2022
fe2c8f4
Delete .DS_Store
Jordatious Aug 16, 2022
cabb1e0
Merge remote-tracking branch 'origin/casa6' into HPC_parameter
mb010 Sep 9, 2022
aa76d88
Merge remote-tracking branch 'origin/master' into v2_merge
mb010 Sep 9, 2022
d4ba314
Merge branch 'v2_merge' into HPC_parameter
Feb 21, 2023
2f4f248
Galahad container update
Feb 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@

build/
dist/
venv/
.vscode/settings.json
processMeerKAT/workspace.code-workspace
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ This pipeline is designed to run on the Ilifu cluster, making use of SLURM and M

## 1. Setup the pipeline in your environment

**Please note : These docs are for an upcoming release of the pipeline. At the time of writing (July 2022) please use the CASA6 branch of the pipeline, which is the pre-release version. The master branch will be updated at the time of release.**

In order to use the `processMeerKAT.py` script, source the `setup.sh` file, which can be done on [ilifu](https://docs.ilifu.ac.za/#/) as

source /idia/software/pipelines/master/setup.sh
Expand Down Expand Up @@ -67,6 +65,6 @@ Starting with v1.1 of the processMeerKAT pipeline, the default behaviour is to s

2. **Logs in the top level directory** : Logs in the top level directory (*i.e.,* the directory where the pipeline was launched) correspond to the scripts in the `precal_scripts` and `postcal_scripts` variables in the config file. These scripts are run from the top level before and after calibration respectively. By default these correspond to the scripts to calculate the reference antenna (if enabled), partition the data into SPWs, and concat the individual SPWs back into a single MS/MMS.

More detailed information about SPW splitting is found [here](/docs/processMeerKAT/config-files#spw-splitting).
More detailed information about SPW splitting is found [here](https://idia-pipelines.github.io/docs/processMeerKAT/config-files#spw-splitting).

The documentation can be accessed on the [pipelines website](https://idia-pipelines.github.io/docs/processMeerKAT), or on the [Github wiki](https://github.com/idia-astro/pipelines/wiki).
4 changes: 4 additions & 0 deletions processMeerKAT/aux_scripts/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import glob
from shutil import copytree

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
from config_parser import validate_args as va
import bookkeeping
Expand Down
2 changes: 1 addition & 1 deletion processMeerKAT/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def parse_args():
Parse the command line arguments
"""
parser = argparse.ArgumentParser()
parser.add_argument('-C','--config', default=processMeerKAT.CONFIG, required=False, help='Name of the input config file')
parser.add_argument('-C','--config', default="myconfig.txt", required=False, help='Name of the input config file')

args, __ = parser.parse_known_args()

Expand Down
10 changes: 7 additions & 3 deletions processMeerKAT/crosscal_scripts/calc_refant.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"""
Calculates the reference antenna
"""
import os, sys
import numpy as np

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
from config_parser import validate_args as va
import bookkeeping

import os
import numpy as np

from casatasks import *
logfile=casalog.logfile()
casalog.setlogfile('logs/{SLURM_JOB_NAME}-{SLURM_JOB_ID}.casa'.format(**os.environ))
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/flag_round_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
from config_parser import validate_args as va
import bookkeeping
Expand Down
5 changes: 5 additions & 0 deletions processMeerKAT/crosscal_scripts/flag_round_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))


import config_parser
from config_parser import validate_args as va
import bookkeeping
Expand Down
14 changes: 13 additions & 1 deletion processMeerKAT/crosscal_scripts/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))


import config_parser
from config_parser import validate_args as va
import read_ms
Expand Down Expand Up @@ -47,6 +52,13 @@ def main(args,taskvals):
include_crosshand = va(taskvals, 'run', 'dopol', bool, default=False)
createmms = va(taskvals, 'crosscal', 'createmms', bool, default=True)

# HPC Specific Configuration
known_hpc_path = os.path.dirname(SCRIPT_DIR)+"/known_hpc.cfg"
KNOWN_HPCS, HPC_CONFIG = config_parser.parse_config(known_hpc_path)
HPC_NAME = taskvals["run"]["hpc"]
HPC_NAME = HPC_NAME if HPC_NAME in KNOWN_HPCS.keys() else "unknown"
CPUS_PER_NODE_LIMIT = va(KNOWN_HPCS, HPC_NAME, "CPUS_PER_NODE_LIMIT".lower(), dtype=int)

if nspw > 1:
casalog.setlogfile('logs/{SLURM_JOB_NAME}-{SLURM_ARRAY_JOB_ID}_{SLURM_ARRAY_TASK_ID}.casa'.format(**os.environ))
else:
Expand All @@ -64,7 +76,7 @@ def main(args,taskvals):

if not include_crosshand and npol == 4:
npol = 2
CPUs = npol if tasks*npol <= processMeerKAT.CPUS_PER_NODE_LIMIT else 1 #hard-code for number of polarisations
CPUs = npol if tasks*npol <= CPUS_PER_NODE_LIMIT else 1 #hard-code for number of polarisations

mvis = do_partition(visname, spw, preavg, CPUs, include_crosshand, createmms, spwname)
mvis = "'{0}'".format(mvis)
Expand Down
6 changes: 6 additions & 0 deletions processMeerKAT/crosscal_scripts/plot_solutions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#Copyright (C) 2022 Inter-University Institute for Data Intensive Astronomy
#See processMeerKAT.py for license details.

import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
from config_parser import validate_args as va
import bookkeeping
Expand Down
6 changes: 6 additions & 0 deletions processMeerKAT/crosscal_scripts/plotcal_spw.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

#!/usr/bin/env python3

import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import glob
import config_parser
import traceback
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/quick_tclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
from config_parser import validate_args as va
import bookkeeping
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/setjy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

import os, sys, shutil

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import bookkeeping
from config_parser import validate_args as va
import numpy as np
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
import bookkeeping
from config_parser import validate_args as va
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/xx_yy_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import sys
import os

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
import bookkeeping
from config_parser import validate_args as va
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/xx_yy_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import os
import shutil

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
import bookkeeping
from config_parser import validate_args as va
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/xy_yx_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import os
import shutil

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
import bookkeeping, read_ms
from config_parser import validate_args as va
Expand Down
4 changes: 4 additions & 0 deletions processMeerKAT/crosscal_scripts/xy_yx_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import os
import shutil

# Adapt PYTHONPATH to include processMeerKAT
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

import config_parser
import bookkeeping
from config_parser import validate_args as va
Expand Down
125 changes: 125 additions & 0 deletions processMeerKAT/known_hpc.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
[DEFAULT]
# Set global limits for current ilifu cluster configuration
TOTAL_NODES_LIMIT = 79
CPUS_PER_NODE_LIMIT = 32
NTASKS_PER_NODE_LIMIT = %(CPUS_PER_NODE_LIMIT)s
MEM_PER_NODE_GB_LIMIT = 232 #237568 MB
MEM_PER_NODE_GB_LIMIT_HIGHMEM = 480 #491520 MB
ACCOUNTS = ['b03-idia-ag','b05-pipelines-ag']

# Set global values for paths and file names
LOG_DIR = 'logs'
CALIB_SCRIPTS_DIR = 'crosscal_scripts'
AUX_SCRIPTS_DIR = 'aux_scripts'
SELFCAL_SCRIPTS_DIR = 'selfcal_scripts'
CONFIG = 'default_config.txt'
TMP_CONFIG = '.config.tmp'
MASTER_SCRIPT = 'submit_pipeline.sh'
SPW_PREFIX = '*:'
PARTITION = 'Main'
MODULES = ['openmpi/2.1.1']
QOS = 'qos-interactive'
path_binding = ''

# Set global values for field, crosscal and SLURM arguments copied to config file, and some of their default values
FIELDS_CONFIG_KEYS = [
'fluxfield','bpassfield','phasecalfield',
'targetfields','extrafields'
]
CROSSCAL_CONFIG_KEYS = [
'minbaselines','chanbin','width','timeavg','createmms',
'keepmms','spw','nspw','calcrefant','refant','standard',
'badants','badfreqranges'
]
SELFCAL_CONFIG_KEYS = [
'nloops','loop','cell','robust','imsize','wprojplanes',
'niter','threshold','uvrange','nterms','gridder','deconvolver',
'solint','calmode','discard_nloops','gaintype',
'outlier_threshold','flag'
]
IMAGING_CONFIG_KEYS = [
'cell', 'robust', 'imsize', 'wprojplanes', 'niter',
'threshold', 'multiscale', 'nterms', 'gridder',
'deconvolver', 'restoringbeam', 'specmode',
'stokes', 'mask', 'rmsmap'
]
SLURM_CONFIG_STR_KEYS = [
'container','mpi_wrapper','partition','time','name',
'dependencies','exclude','account','reservation'
]
SLURM_CONFIG_KEYS_BASE = [
'nodes','ntasks_per_node','mem','plane','submit',
'precal_scripts','postcal_scripts','scripts',
'verbose','modules'
]
CONTAINER = "/idia/software/containers/casa-6.3.simg"
MPI_WRAPPER = 'mpirun'
PRECAL_SCRIPTS = [('calc_refant.py',False,''),('partition.py',True,'')] #Scripts run before calibration at top level directory when nspw > 1
POSTCAL_SCRIPTS = [
('concat.py',False,''),
('plotcal_spw.py', False, ''),
('selfcal_part1.py',True,''),
('selfcal_part2.py',False,''),
('science_image.py', True, '')
] #Scripts run after calibration at top level directory when nspw > 1
SCRIPTS = [
('validate_input.py',False,''),
('flag_round_1.py',True,''),
('calc_refant.py',False,''),
('setjy.py',True,''),
('xx_yy_solve.py',False,''),
('xx_yy_apply.py',True,''),
('flag_round_2.py',True,''),
('xx_yy_solve.py',False,''),
('xx_yy_apply.py',True,''),
('split.py',True,''),
('quick_tclean.py',True,'')
]
# sbatch_file_base must use linebreaks for #SBATCH lines! Otherwise python reads them as comments, and ignores them.
submission_file_base = "#!/bin/bash{array}{exclude}{reservation}\n#SBATCH --account={account}\n#SBATCH --nodes={nodes}\n#SBATCH --ntasks-per-node={tasks}\n#SBATCH --cpus-per-task={cpus}\n#SBATCH --mem={mem}GB\n#SBATCH --job-name={runname}{name}\n#SBATCH --distribution=plane={plane}\n#SBATCH --output={LOG_DIR}/%%x-{ID}.out\n#SBATCH --error={LOG_DIR}/%%x-{ID}.err\n#SBATCH --partition={partition}\n#SBATCH --time={time}"

[ilifu]
# [DEFAULT] section defined at the top of this file represents the ilifu configuration.

[unknown]
# Differences to default: memory / node limits are functionally unlimited.
TOTAL_NODES_LIMIT = 5096
CPUS_PER_NODE_LIMIT = 1024
NTASKS_PER_NODE_LIMIT = %(CPUS_PER_NODE_LIMIT)s
MEM_PER_NODE_GB_LIMIT = 5000 #237568 MB
MEM_PER_NODE_GB_LIMIT_HIGHMEM = 5000 #491520 MB
ACCOUNTS = ['']

[galahad]
# Specify differences to ilifu
TOTAL_NODES_LIMIT = 17 # Total number of hmem nodes
CPUS_PER_NODE_LIMIT = 16 # Number of threads on hmem nodes
NTASKS_PER_NODE_LIMIT = %(CPUS_PER_NODE_LIMIT)s
MEM_PER_NODE_GB_LIMIT = 1500 # GB; 1.5TB available
MEM_PER_NODE_GB_LIMIT_HIGHMEM = 1500 # GB; 1.5 TB availble
ACCOUNTS = [''] # List of allowed accounts; Not currently used: see sbatch_file_base ### update me!!!
CONTAINER = '/share/nas/mbowles/casa-6_v2.simg' # Previously used '/share/nas/mbowles/mightee/casa-stable.simg'
PARTITION = 'CLUSTER'
QOS = 'Normal'
MPI_WRAPPER = 'mpirun --mca oob tcp'
MODULES = ['openmpi-2.1.1']
path_binding = '--bind /share:/share '
# Must use linebreaks for #SBATCH lines! Otherwise python reads them as comments, and ignores them.
submission_file_base = "#!/bin/bash{array}{exclude}{reservation}\n#SBATCH --nodes={nodes}\n#SBATCH --ntasks-per-node={tasks}\n#SBATCH --cpus-per-task={cpus}\n#SBATCH --mem={mem}GB\n#SBATCH --job-name={runname}{name}\n#SBATCH --distribution=plane={plane}\n#SBATCH --output={LOG_DIR}/%%x-{ID}.out\n#SBATCH --error={LOG_DIR}/%%x-{ID}.err\n#SBATCH --time={time}"

[petrichor]
# Specify differences to ilifu
TOTAL_NODES_LIMIT = 110
CPUS_PER_NODE_LIMIT = 64
NTASKS_PER_NODE_LIMIT = %(CPUS_PER_NODE_LIMIT)s
MEM_PER_NODE_GB_LIMIT = 512 # GB
MEM_PER_NODE_GB_LIMIT_HIGHMEM = 1000 #
ACCOUNTS = [''] # List of allowed accounts; Not currently used: see sbatch_file_base ### update me!!!
CONTAINER = '/scratch1/tho822/containers/casa-pipeline/casa-6.1.2.7-modular.simg' #
PARTITION = 'defq'
QOS = 'express'
MPI_WRAPPER = 'mpirun'
MODULES = ['singularity', 'use.own', 'openmpi/2.1.1']
path_binding = '--bind /scratch1:/scratch1,/scratch2:/scratch2 '
# Must use linebreaks for #SBATCH lines! Otherwise python reads them as comments, and ignores them.
submission_file_base = "#!/bin/bash{array}{exclude}{reservation}\n#SBATCH --nodes={nodes}\n#SBATCH --ntasks-per-node={tasks}\n#SBATCH --cpus-per-task={cpus}\n#SBATCH --mem={mem}GB\n#SBATCH --job-name={runname}{name}\n#SBATCH --distribution=plane={plane}\n#SBATCH --output={LOG_DIR}/%%x-{ID}.out\n#SBATCH --error={LOG_DIR}/%%x-{ID}.err\n#SBATCH --time={time}"
Loading