Skip to content

Commit

Permalink
Add basic helloworld script
Browse files Browse the repository at this point in the history
  • Loading branch information
vanpelt committed Aug 8, 2024
1 parent 9adbc45 commit 99f4b50
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jobs/slurm/helloworld/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: helloworld
channels:
- conda-forge
dependencies:
- python=3.12
- pip
- pip:
- wandb
- weave
12 changes: 12 additions & 0 deletions jobs/slurm/helloworld/helloworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import wandb
from wandb.sdk import launch
import os
import time

name = f"{os.environ["SLURM_JOB_NAME"]} ({os.environ["SLURM_JOB_ID"]})"
wandb.init(project="helloworld-slurm", name=name, group=f"slurm-{os.environ["SLURM_JOB_ID"]}", config={"hello": "default"})
launch.manage_wandb_config(include=["hello"])

print("wandb.config: ", dict(wandb.config))
time.sleep(30)
print("Goodbye world!")
21 changes: 21 additions & 0 deletions jobs/slurm/helloworld/helloworld.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

#SBATCH --job-name=example1
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --output=slurm-%x-%j.out

source ~/.bashrc

set -x -e

echo "START TIME: $(date)"

LOG_PATH="helloworld.log"

conda activate helloworld
export CMD="python helloworld.py"

srun --jobid $SLURM_JOBID bash -c "$CMD" 2>&1 | tee -a $LOG_PATH

echo "END TIME: $(date)"

0 comments on commit 99f4b50

Please sign in to comment.