mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 23:58:02 +00:00
aaa14fc880
* Add RAMSES2HDF5 conversion * Upload changes * Clean up * More clean up * updates * Little change * pep9 * Add basic SPH calculation for a snapshot * Add submit script * Remove echo * Little changes * Send off changes * Little formatting * Little updates * Add nthreads argument * Upload chagnes * Add nthreads arguemnts * Some local changes.. * Update scripts * Add submission script * Update script * Update params * Rename CSiBORGBox to CSiBORG1box * Rename CSiBORG1 reader * Move files * Rename folder again * Add basic plotting here * Add new skeletons * Move def * Update nbs * Edit directories * Rename files * Add units to converted snapshots * Fix empty dataset bug * Delete file * Edits to submission scripts * Edit paths * Update .gitignore * Fix attrs * Update weighting * Fix RA/dec bug * Add FORNAX cluster * Little edit * Remove boxes since will no longer need * Move func back * Edit to include sort by membership * Edit paths * Purge basic things * Start removing * Bring file back * Scratch * Update the rest * Improve the entire file * Remove old things * Remove old * Delete old things * Fully updates * Rename file * Edit submit script * Little things * Add print statement * Add here cols_to_structured * Edit halo cat * Remove old import * Add comment * Update paths manager * Move file * Remove file * Add chains
89 lines
3.3 KiB
Python
89 lines
3.3 KiB
Python
# Copyright (C) 2023 Richard Stiskalek
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by the
|
|
# Free Software Foundation; either version 3 of the License, or (at your
|
|
# option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
# Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
"""
|
|
Script to write the SLURM submission script and submit it to the queue to
|
|
calculate the SPH density & velocity field.
|
|
"""
|
|
from os import system
|
|
|
|
|
|
def write_submit(chain_index, kind, resolution, nthreads):
|
|
if kind not in ["main", "random", "varysmall"]:
|
|
raise RuntimeError(f"Unknown kind `{kind}`.")
|
|
|
|
txt = f"""#!/bin/sh
|
|
|
|
#SBATCH --ntasks-per-node=1
|
|
#SBATCH --nodes=1
|
|
#SBATCH --cpus-per-task={nthreads}
|
|
#SBATCH --mem-per-cpu=7000
|
|
#SBATCH -J SPH_{chain_index}
|
|
#SBATCH -o output_{chain_index}_%J.out
|
|
#SBATCH -e error_{chain_index}_%J.err
|
|
#SBATCH -p cosma8-serial
|
|
#SBATCH -A dp016
|
|
#SBATCH -t 16:00:00
|
|
#SBATCH --mail-type=BEGIN,END,FAIL
|
|
#SBATCH --mail-user=richard.stiskalek@physics.ox.ac.uk
|
|
|
|
|
|
module purge
|
|
module load intel_comp/2019
|
|
module load intel_mpi/2019
|
|
module load hdf5
|
|
module load fftw
|
|
module load gsl
|
|
module load cmake
|
|
module load python/3.10.12
|
|
module list
|
|
|
|
source /cosma/home/dp016/dc-stis1/csiborgtools/venv_csiborgtools/bin/activate
|
|
export OMP_NUM_THREADS={nthreads}
|
|
export OMP_NESTED=true
|
|
|
|
snapshot_path="/cosma8/data/dp016/dc-stis1/csiborg2_{kind}/chain_{chain_index}/output/snapshot_099_full.hdf5"
|
|
output_path="/cosma8/data/dp016/dc-stis1/csiborg2_{kind}/field/chain_{chain_index}_{resolution}.hdf5"
|
|
resolution={resolution}
|
|
scratch_space="/snap8/scratch/dp016/dc-stis1/"
|
|
SPH_executable="/cosma8/data/dp016/dc-stis1/cosmotool/bld2/sample/simple3DFilter"
|
|
snapshot_kind="gadget4"
|
|
|
|
python3 field_sph.py --snapshot_path $snapshot_path --output_path $output_path --resolution $resolution --scratch_space $scratch_space --SPH_executable $SPH_executable --snapshot_kind $snapshot_kind
|
|
"""
|
|
fname = f"submit_SPH_{kind}_{chain_index}.sh"
|
|
print(f"Writing file: `{fname}`.")
|
|
with open(fname, "w") as txtfile:
|
|
txtfile.write(txt)
|
|
# Make the file executable
|
|
system(f"chmod +x {fname}")
|
|
return fname
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# kind = "main"
|
|
# chains = [15617, 15717, 15817, 15917, 16017, 16117, 16217, 16317, 16417, 16517, 16617, 16717, 16817, 16917, 17017, 17117, 17217, 17317, 17417]
|
|
|
|
# kind = "varysmall"
|
|
# chains = ["16417_001", "16417_025", "16417_050", "16417_075", "16417_100", "16417_125", "16417_150", "16417_175", "16417_200", "16417_225", "16417_250", "16417_275", "16417_300", "16417_325", "16417_350", "16417_375", "16417_400", "16417_425", "16417_450", "16417_475"]
|
|
|
|
kind = "random"
|
|
chains = [1, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425, 450, 475]
|
|
|
|
resolution = 1024
|
|
nthreads = 32
|
|
|
|
for chain_index in chains:
|
|
fname = write_submit(chain_index, kind, resolution, nthreads)
|
|
system(f"sbatch {fname}")
|