-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
199 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
name: adept | ||
name: adept-gpu | ||
channels: | ||
- conda-forge | ||
- "nvidia/label/cuda-11.7.0" | ||
- nvidia | ||
dependencies: | ||
- python=3.10 | ||
- ipython | ||
- ipykernel | ||
- cuda-nvcc | ||
- cudatoolkit==11.7.0 | ||
- pip | ||
- pip: | ||
# works for regular pip packages | ||
- --find-links https://storage.googleapis.com/jax-releases/jax_cuda_releases.html | ||
- "jax[cuda11_cudnn82]" | ||
- jaxlib==0.4.20+cuda12.cudnn89 | ||
- jax==0.4.20 | ||
- jaxopt | ||
- numpy | ||
- scipy | ||
- matplotlib | ||
- pyhdf | ||
- xlrd | ||
- pyyaml | ||
- mlflow | ||
- boto3 | ||
- flatdict | ||
- typing-extensions | ||
- optax | ||
- tqdm | ||
- xarray | ||
- mlflow_export_import | ||
- pint | ||
- diffrax | ||
- h5netcdf | ||
- optax | ||
- jaxopt | ||
- flatdict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
#SBATCH --qos=debug | ||
#SBATCH --time=5 | ||
#SBATCH --nodes=1 | ||
#SBATCH --ntasks-per-node=1 | ||
#SBATCH --constraint=cpu | ||
|
||
export BASE_TEMPDIR="$PSCRATCH/tmp/" | ||
export MLFLOW_TRACKING_URI="$PSCRATCH/mlflow" | ||
|
||
source /global/u2/a/archis/adept/venv/bin/activate | ||
cd /global/u2/a/archis/adept/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
#SBATCH -A m4434_g | ||
#SBATCH -C gpu | ||
#SBATCH -q shared | ||
#SBATCH -t 2:00:00 | ||
#SBATCH -n 1 | ||
#SBATCH -c 32 | ||
#SBATCH --gpus-per-task=1 | ||
|
||
export SLURM_CPU_BIND="cores" | ||
export BASE_TEMPDIR="$PSCRATCH/tmp/" | ||
export MLFLOW_TRACKING_URI="$PSCRATCH/mlflow" | ||
|
||
# copy job stuff over | ||
module load python | ||
module load cudnn/8.9.3_cuda12.lua | ||
module load cudatoolkit/12.0.lua | ||
|
||
mamba activate adept-gpu | ||
cd /global/u2/a/archis/adept/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import argparse | ||
import os | ||
import tempfile | ||
import time | ||
|
||
import mlflow | ||
import yaml | ||
|
||
if "BASE_TEMPDIR" in os.environ: | ||
BASE_TEMPDIR = os.environ["BASE_TEMPDIR"] | ||
else: | ||
BASE_TEMPDIR = None | ||
|
||
|
||
def _queue_run_(machine, run_id): | ||
if "cpu" in machine: | ||
base_job_file = os.environ["CPU_BASE_JOB_FILE"] | ||
elif "gpu" in machine: | ||
base_job_file = os.environ["GPU_BASE_JOB_FILE"] | ||
else: | ||
raise NotImplementedError | ||
|
||
with open(base_job_file, "r") as fh: | ||
base_job = fh.read() | ||
|
||
with open(os.path.join(os.getcwd(), "new_job.sh"), "w") as job_file: | ||
job_file.write(base_job) | ||
job_file.writelines(f"srun python run.py --mode remote --run_id {run_id}") | ||
|
||
os.system(f"sbatch new_job.sh") | ||
time.sleep(0.1) | ||
os.system("sqs") | ||
|
||
|
||
def load_and_make_folders(cfg_path): | ||
with open(f"{cfg_path}.yaml", "r") as file: | ||
cfg = yaml.safe_load(file) | ||
|
||
mlflow.set_experiment(cfg["mlflow"]["experiment"]) | ||
# modify config | ||
with mlflow.start_run(run_name=cfg["mlflow"]["run"]) as run: | ||
tags = {"sim_status": "queued"} | ||
with tempfile.TemporaryDirectory(dir=BASE_TEMPDIR) as temp_path: | ||
with open(os.path.join(temp_path, "config.yaml"), "w") as fp: | ||
yaml.dump(cfg, fp) | ||
mlflow.log_artifacts(temp_path) | ||
mlflow.set_tags(tags) | ||
|
||
return cfg, run.info.run_id | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Automatic Differentiation Enabled Plasma Transport") | ||
parser.add_argument("--cfg", help="enter path to cfg") | ||
args = parser.parse_args() | ||
|
||
cfg, run_id = load_and_make_folders(args.cfg) | ||
_queue_run_(cfg["machine"]["calculator"], run_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,6 @@ flatdict | |
h5netcdf | ||
optax | ||
jaxopt | ||
boto3 | ||
boto3 | ||
pint | ||
mlflow_export_import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
import argparse | ||
import os | ||
|
||
from jax import config | ||
|
||
config.update("jax_enable_x64", True) | ||
# config.update("jax_disable_jit", True) | ||
|
||
import yaml, mlflow | ||
from utils.runner import run | ||
from utils.runner import run, run_job | ||
from utils.misc import export_run | ||
|
||
if __name__ == "__main__": | ||
|
||
def _run_(cfg_path): | ||
# with open("configs/tf-1d/damping.yaml", "r") as fi: | ||
with open("configs/vlasov-2d/base.yaml", "r") as fi: | ||
with open(f"{cfg_path}.yaml", "r") as fi: | ||
cfg = yaml.safe_load(fi) | ||
|
||
mlflow.set_experiment(cfg["mlflow"]["experiment"]) | ||
# modify config | ||
with mlflow.start_run(run_name=cfg["mlflow"]["run"]) as mlflow_run: | ||
result, datasets = run(cfg) | ||
|
||
return mlflow_run.info.run_id | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Automatic Differentiation Enabled Plasma Transport") | ||
parser.add_argument("--cfg", help="enter path to cfg") | ||
parser.add_argument("--run_id", help="enter run_id to continue") | ||
args = parser.parse_args() | ||
|
||
if args.mode == "local": | ||
run_id = _run_(args.cfg) | ||
|
||
elif args.mode == "remote": | ||
run_job(args.run_id, nested=None) | ||
run_id = args.run_id | ||
|
||
if "MLFLOW_EXPORT" in os.environ: | ||
export_run(run_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters