-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslurm_new.sh
executable file
·63 lines (54 loc) · 1.87 KB
/
slurm_new.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
#SBATCH --job-name=run_models
#SBATCH --output=./slurm_logs/output_%A_%a.log
#SBATCH --ntasks=5
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
#SBATCH --time=01:00:00
#SBATCH --array=1-5
#SBATCH --nodes=5
start_indices=(1 11 21 31 41)
end_indices=(10 20 30 40 50)
task_id=$SLURM_ARRAY_TASK_ID
Rscript ~/project_directory/scripts/run_model.R ${start_indices[$((task_id-1))]} ${end_indices[$((task_id-1))]}
# #!/bin/bash
# #SBATCH --job-name=run_models
# #SBATCH --output=logs/output_%A_%a.log # Log files will be saved in the logs directory
# #SBATCH --ntasks=5
# #SBATCH --cpus-per-task=1
# #SBATCH --mem=4G
# #SBATCH --time=01:00:00
# #SBATCH --array=1-5
# #SBATCH --nodes=5
#
# # Create directories if they don't exist
# mkdir -p ~/project_directory/results
# mkdir -p ~/project_directory/logs
#
# start_indices=(1 11 21 31 41)
# end_indices=(10 20 30 40 50)
#
# task_id=$SLURM_ARRAY_TASK_ID
#
# # Run the R script with the corresponding start and end indices
# Rscript ~/project_directory/scripts/run_model.R ${start_indices[$((task_id-1))]} ${end_indices[$((task_id-1))]}
# #!/bin/bash
# #SBATCH --job-name=run_models # Job name
# #SBATCH --output=output_%j.log # Output log file (one for each job)
# #SBATCH --ntasks=1 # Number of tasks (processes)
# #SBATCH --cpus-per-task=1 # Number of CPU cores per task
# #SBATCH --mem=4G # Memory per node
# #SBATCH --time=01:00:00 # Time limit (HH:MM:SS)
# #SBATCH --array=1-5 # Array job, run 5 tasks
#
# # Define start and end indices for each task
# start_indices=(1 11 21 31 41)
# end_indices=(10 20 30 40 50)
#
# # Get the array task ID (1 to 5)
# task_id=$SLURM_ARRAY_TASK_ID
#
# # Run the R script with the corresponding start and end indices
# Rscript ~/project_directory/scripts/run_model.R ${start_indices[$((task_id-1))]} ${end_indices[$((task_id-1))]}
#
#