Skip to content

Commit

Permalink
run commands within apptainer
Browse files Browse the repository at this point in the history
  • Loading branch information
thayeral committed Oct 28, 2024
1 parent 0e912f7 commit a6cfce2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
8 changes: 5 additions & 3 deletions src/ray_check_status.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# conda create -n ray -c conda-forge python=3.10.12 "ray-all"=2.37.0 -y
source ~/.bashrc
conda activate ray
echo "Activated conda environment: ray"
#source ~/.bashrc
#conda activate ray
#echo "Activated conda environment: ray"

export LC_ALL=C.UTF-8
export LANG=C.UTF-8
Expand All @@ -27,6 +27,8 @@ while getopts ":e:a:r:" option;do
esac
done

echo "Starting apptainer: $env"
$env bash

TIMEOUT=60 # seconds
check="ray status --address $cluster_address"
Expand Down
5 changes: 0 additions & 5 deletions src/ray_lsf_cluster.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

# conda create -n ray -c conda-forge python=3.10.12 "ray-all"=2.37.0 -y
source ~/.bashrc
conda activate ray
echo "Activated conda environment: ray"

while getopts ":e:n:c:g:o:w:" option;do
case "${option}" in
e) e=${OPTARG}
Expand Down
5 changes: 0 additions & 5 deletions src/ray_lsf_cluster_parallel.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

# conda create -n ray -c conda-forge python=3.10.12 "ray-all"=2.37.0 -y
source ~/.bashrc
conda activate ray
echo "Activated conda environment: ray"

while getopts ":n:c:g:o:w:" option;do
case "${option}" in
n) n=${OPTARG}
Expand Down
13 changes: 8 additions & 5 deletions src/ray_start_cluster.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# conda create -n ray -c conda-forge python=3.10.12 "ray-all"=2.37.0 -y
source ~/.bashrc
conda activate ray
echo "Activated conda environment: ray"
#source ~/.bashrc
#conda activate ray
#echo "Activated conda environment: ray"

export LC_ALL=C.UTF-8
export LANG=C.UTF-8
Expand Down Expand Up @@ -41,9 +41,12 @@ done

cluster_address="$ip:$port"

echo "Starting apptainer: $env"
$env bash

echo "Starting ray head node @ $(hostname) => $cluster_address with CPUs[$cpus] & GPUs [$gpus]"
job="ray start --head --node-ip-address=$ip --port=$port --dashboard-port=$dashboard_port --dashboard-host=0.0.0.0 --temp-dir=/tmp/ray_symlink --num-cpus=$cpus --num-gpus=$gpus"
echo $env $job
$env $job &
echo $job
$job &

sleep infinity
13 changes: 8 additions & 5 deletions src/ray_start_worker.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

# conda create -n ray -c conda-forge python=3.10.12 "ray-all"=2.37.0 -y
source ~/.bashrc
conda activate ray
echo "Activated conda environment: ray"
#source ~/.bashrc
#conda activate ray
#echo "Activated conda environment: ray"

export LC_ALL=C.UTF-8
export LANG=C.UTF-8
Expand Down Expand Up @@ -31,10 +31,13 @@ while getopts ":e:a:c:g:" option;do
esac
done

echo "Starting apptainer: $env"
$env bash

echo "Starting ray worker @ $(hostname) with CPUs[$cpus] & GPUs [$gpus] => $cluster_address"
job="ray start --address=$cluster_address --num-cpus=$cpus --num-gpus=$gpus"
echo $env $job
$env $job &
echo $job
$job &

echo "Ray worker LSF ID: $LSB_JOBID"
sleep infinity

0 comments on commit a6cfce2

Please sign in to comment.