From d8e5f1147c80e3786b0a6228c079b0cbd9370db8 Mon Sep 17 00:00:00 2001
From: pat-alt <altmeyerpat@gmail.com>
Date: Mon, 16 Oct 2023 13:45:32 +0200
Subject: [PATCH] set up grid search with mutli-threading on delftblue

---
 .../jobscripts/testing/lin_sep_threaded.sh       | 10 +++++-----
 .../tuning/generators/california_housing.sh      | 12 +++++++-----
 .../jobscripts/tuning/generators/circles.sh      | 12 +++++++-----
 .../tuning/generators/german_credit.sh           | 16 ++++++++++++++++
 experiments/jobscripts/tuning/generators/gmsc.sh | 16 ++++++++++++++++
 .../tuning/generators/linearly_separable.sh      | 16 ++++++++++++++++
 .../jobscripts/tuning/generators/moons.sh        | 16 ++++++++++++++++
 .../jobscripts/tuning/generators/synthetic.sh    | 14 --------------
 .../jobscripts/tuning/generators/tabular.sh      | 14 --------------
 experiments/setup_env.jl                         |  5 ++++-
 10 files changed, 87 insertions(+), 44 deletions(-)
 create mode 100644 experiments/jobscripts/tuning/generators/german_credit.sh
 create mode 100644 experiments/jobscripts/tuning/generators/gmsc.sh
 create mode 100644 experiments/jobscripts/tuning/generators/linearly_separable.sh
 create mode 100644 experiments/jobscripts/tuning/generators/moons.sh
 delete mode 100644 experiments/jobscripts/tuning/generators/synthetic.sh
 delete mode 100644 experiments/jobscripts/tuning/generators/tabular.sh

diff --git a/experiments/jobscripts/testing/lin_sep_threaded.sh b/experiments/jobscripts/testing/lin_sep_threaded.sh
index 9c7dfa85..be7aa826 100644
--- a/experiments/jobscripts/testing/lin_sep_threaded.sh
+++ b/experiments/jobscripts/testing/lin_sep_threaded.sh
@@ -1,11 +1,11 @@
 #!/bin/bash
 
 #SBATCH --job-name="Grid-search Linearly Separable (ECCCo)"
-#SBATCH --time=01:00:00
-#SBATCH --ntasks=20
-#SBATCH --cpus-per-task=20
+#SBATCH --time=00:30:00
+#SBATCH --ntasks=14
+#SBATCH --cpus-per-task=14
 #SBATCH --partition=compute
-#SBATCH --mem-per-cpu=2GB
+#SBATCH --mem-per-cpu=4GB
 #SBATCH --account=research-eemcs-insy
 #SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
 
@@ -13,4 +13,4 @@ module load 2023r1 openmpi
 
 source experiments/slurm_header.sh
 
-srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=linearly_separable output_path=results mpi grid_search n_individuals=100 threaded > experiments/grid_search_linearly_separable.log
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=linearly_separable output_path=results mpi grid_search n_individuals=20 threaded > experiments/grid_search_linearly_separable.log
diff --git a/experiments/jobscripts/tuning/generators/california_housing.sh b/experiments/jobscripts/tuning/generators/california_housing.sh
index ded42416..772c8117 100644
--- a/experiments/jobscripts/tuning/generators/california_housing.sh
+++ b/experiments/jobscripts/tuning/generators/california_housing.sh
@@ -1,14 +1,16 @@
 #!/bin/bash
 
 #SBATCH --job-name="Grid-search California Housing (ECCCo)"
-#SBATCH --time=02:00:00
-#SBATCH --ntasks=100
-#SBATCH --cpus-per-task=1
+#SBATCH --time=01:00:00
+#SBATCH --ntasks=20
+#SBATCH --cpus-per-task=20
 #SBATCH --partition=compute
-#SBATCH --mem-per-cpu=8GB
+#SBATCH --mem-per-cpu=2GB
 #SBATCH --account=research-eemcs-insy
 #SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
 
 module load 2023r1 openmpi
 
-srun julia --project=experiments experiments/run_experiments.jl -- data=california_housing output_path=results mpi grid_search n_individuals=20 store_ce > experiments/grid_search_california_housing.log
+source experiments/slurm_header.sh
+
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=california_housing output_path=results mpi grid_search threaded n_individuals=10 > experiments/logs/grid_search_california_housing.log
diff --git a/experiments/jobscripts/tuning/generators/circles.sh b/experiments/jobscripts/tuning/generators/circles.sh
index 5d926be3..f9bc0129 100644
--- a/experiments/jobscripts/tuning/generators/circles.sh
+++ b/experiments/jobscripts/tuning/generators/circles.sh
@@ -1,14 +1,16 @@
 #!/bin/bash
 
 #SBATCH --job-name="Grid-search Circles (ECCCo)"
-#SBATCH --time=02:00:00
-#SBATCH --ntasks=100
-#SBATCH --cpus-per-task=1
+#SBATCH --time=01:00:00
+#SBATCH --ntasks=30
+#SBATCH --cpus-per-task=30
 #SBATCH --partition=compute
-#SBATCH --mem-per-cpu=8GB
+#SBATCH --mem-per-cpu=1GB
 #SBATCH --account=research-eemcs-insy
 #SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
 
 module load 2023r1 openmpi
 
-srun julia --project=experiments experiments/run_experiments.jl -- data=circles output_path=results mpi grid_search > experiments/grid_search_circles.log
+source experiments/slurm_header.sh
+
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=circles output_path=results mpi grid_search threaded n_individuals=100 > experiments/logs/grid_search_circles.log
diff --git a/experiments/jobscripts/tuning/generators/german_credit.sh b/experiments/jobscripts/tuning/generators/german_credit.sh
new file mode 100644
index 00000000..263ac1bd
--- /dev/null
+++ b/experiments/jobscripts/tuning/generators/german_credit.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH --job-name="Grid-search German Credit (ECCCo)"
+#SBATCH --time=01:00:00
+#SBATCH --ntasks=30
+#SBATCH --cpus-per-task=30
+#SBATCH --partition=compute
+#SBATCH --mem-per-cpu=1GB
+#SBATCH --account=research-eemcs-insy
+#SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
+
+module load 2023r1 openmpi
+
+source experiments/slurm_header.sh
+
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=german_credit output_path=results mpi grid_search threaded n_individuals=100 > experiments/logs/grid_search_german_credit.log
diff --git a/experiments/jobscripts/tuning/generators/gmsc.sh b/experiments/jobscripts/tuning/generators/gmsc.sh
new file mode 100644
index 00000000..729fa36e
--- /dev/null
+++ b/experiments/jobscripts/tuning/generators/gmsc.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH --job-name="Grid-search GMSC (ECCCo)"
+#SBATCH --time=01:00:00
+#SBATCH --ntasks=20
+#SBATCH --cpus-per-task=20
+#SBATCH --partition=compute
+#SBATCH --mem-per-cpu=2GB
+#SBATCH --account=research-eemcs-insy
+#SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
+
+module load 2023r1 openmpi
+
+source experiments/slurm_header.sh
+
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=gmsc output_path=results mpi grid_search threaded n_individuals=10 > experiments/logs/grid_search_gmsc.log
diff --git a/experiments/jobscripts/tuning/generators/linearly_separable.sh b/experiments/jobscripts/tuning/generators/linearly_separable.sh
new file mode 100644
index 00000000..fca9ee05
--- /dev/null
+++ b/experiments/jobscripts/tuning/generators/linearly_separable.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH --job-name="Grid-search Linearly Separable (ECCCo)"
+#SBATCH --time=01:00:00
+#SBATCH --ntasks=30
+#SBATCH --cpus-per-task=30
+#SBATCH --partition=compute
+#SBATCH --mem-per-cpu=1GB
+#SBATCH --account=research-eemcs-insy
+#SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
+
+module load 2023r1 openmpi
+
+source experiments/slurm_header.sh
+
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=linearly_separable output_path=results mpi grid_search threaded n_individuals=100 > experiments/logs/grid_search_linearly_separable.log
diff --git a/experiments/jobscripts/tuning/generators/moons.sh b/experiments/jobscripts/tuning/generators/moons.sh
new file mode 100644
index 00000000..8d81d33a
--- /dev/null
+++ b/experiments/jobscripts/tuning/generators/moons.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH --job-name="Grid-search Moons (ECCCo)"
+#SBATCH --time=01:00:00
+#SBATCH --ntasks=30
+#SBATCH --cpus-per-task=30
+#SBATCH --partition=compute
+#SBATCH --mem-per-cpu=1GB
+#SBATCH --account=research-eemcs-insy
+#SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
+
+module load 2023r1 openmpi
+
+source experiments/slurm_header.sh
+
+srun julia --project=experiments --threads $SLURM_CPUS_PER_TASK experiments/run_experiments.jl -- data=moons output_path=results mpi grid_search threaded n_individuals=100 > experiments/logs/grid_search_moons.log
diff --git a/experiments/jobscripts/tuning/generators/synthetic.sh b/experiments/jobscripts/tuning/generators/synthetic.sh
deleted file mode 100644
index 66bcf412..00000000
--- a/experiments/jobscripts/tuning/generators/synthetic.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-#SBATCH --job-name="Grid-search Synthetic (ECCCo)"
-#SBATCH --time=05:00:00
-#SBATCH --ntasks=100
-#SBATCH --cpus-per-task=1
-#SBATCH --partition=compute
-#SBATCH --mem-per-cpu=8GB
-#SBATCH --account=research-eemcs-insy
-#SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
-
-module load 2023r1 openmpi
-
-srun julia --project=experiments experiments/run_experiments.jl -- data=linearly_separable,moons,circles output_path=results mpi grid_search > experiments/grid_search_synthetic.log
diff --git a/experiments/jobscripts/tuning/generators/tabular.sh b/experiments/jobscripts/tuning/generators/tabular.sh
deleted file mode 100644
index 3c043ea7..00000000
--- a/experiments/jobscripts/tuning/generators/tabular.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-#SBATCH --job-name="Grid-search Tabular (ECCCo)"
-#SBATCH --time=04:00:00
-#SBATCH --ntasks=100
-#SBATCH --cpus-per-task=1
-#SBATCH --partition=compute
-#SBATCH --mem-per-cpu=8GB
-#SBATCH --account=research-eemcs-insy
-#SBATCH --mail-type=END     # Set mail type to 'END' to receive a mail when the job finishes. 
-
-module load 2023r1 openmpi
-
-srun julia --project=experiments experiments/run_experiments.jl -- data=gmsc,german_credit output_path=results mpi grid_search n_individuals=25 store_ce > experiments/grid_search_tabular.log
diff --git a/experiments/setup_env.jl b/experiments/setup_env.jl
index 608f6dc0..931a3c1e 100644
--- a/experiments/setup_env.jl
+++ b/experiments/setup_env.jl
@@ -109,6 +109,9 @@ if "mpi" ∈ ARGS
         @info "Multi-processing using MPI. Disabling logging on non-root processes."
         if USE_THREADS
             @info "Multi-threading using $(Threads.nthreads()) threads."
+            if Threads.threadid() != 1
+                global_logger(NullLogger())
+            end
         end
     end
 else
@@ -196,7 +199,7 @@ DEFAULT_GENERATOR_TUNING = (
 "Generator tuning parameters for large datasets."
 DEFAULT_GENERATOR_TUNING_LARGE = (
     Λ = [[0.1, 0.1, 0.1], [0.1, 0.1, 0.2], [0.2, 0.2, 0.2]],
-    reg_strength = [0.0,],
+    reg_strength=[0.0, 0.1,],
     opt = [
         Descent(0.01), 
         Descent(0.05),
-- 
GitLab