forked from NAG-DevOps/speed-hpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comp371-raytraycer.sh
executable file
·88 lines (73 loc) · 2.02 KB
/
comp371-raytraycer.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/encs/bin/tcsh
##
## Sample raytraycer batch job launching script.
## Intented primarily for COMP371.
##
## Serguei Mokhov
##
## To launch: sbatch comp371-raytraycer.sh
## do it in: /speed-scratch/$USER
##
## Configure your email address and possibly a repo to pull from.
## The script pulls the repo if not already pulled and builds
## if not already built.
##
##
## Job Scheduler options
##
#SBATCH --job-name=c371-raytraycer ## Give the job a name
#SBATCH --mail-type=ALL ## Receive all email type notifications
#SBATCH --chdir=./ ## Use currect directory as working directory
#SBATCH --cpus-per-task=2 ## Request 2 cpus
#SBATCH --mem=1G ## Assign memory per node
#SBATCH -p pt ## Teaching partition by default; can be ps
#SBATCH -A comp371w14 ## Speed Slurm account
##
## Job to run
##
# timestamp
echo "$0 : about to run a COMP371 raytraycer job on Speed"
date
# Print debug environment
env
# Pull the sources at the latest commit only to avoid
# downloading all the history. For fun, time the longer
# running commands.
#
# srun allows to run job steps and diagnose errors with
# sacct and showjob commands
if ( ! -d COMP371_all ) then
echo "Cloning COMP371_all repo..."
time srun git clone --depth=1 https://github.com/tiperiu/COMP371_all.git
else
echo "Found COMP371_all already present; pulling in case of updates..."
cd COMP371_all
time srun git pull --rebase --autostash
cd ..
endif
# We need to be in the raytracer directory
cd COMP371_all/COMP371_RaytracerBase/code
pwd
# Create 'build' if the build folder is absent
if ( ! -d build ) then
mkdir build
else
echo "Found build already present"
endif
# Compile
echo "About to build..."
cd build
cmake ../
time srun make
# Run and report
echo "$0 : about to run raytraycer!"
pwd
date
time srun ./raytracer
ls -al *.ppm
# Later in the course when implementations become available:
#ln -s ../assets/cornell_box_al.json
#time srun ./raytracer cornell_box_al.json
echo "$0 : Done!"
date
# EOF