418d50a3ac82af9c163af9e5a795dfc74efba5e9
examples/careless.md
... | ... | @@ -19,3 +19,81 @@ An error message stating libdevice not found is the indicator that the custom fl |
19 | 19 | |
20 | 20 | |
21 | 21 | |
22 | +``` |
|
23 | + |
|
24 | +#!/usr/bin/env bash |
|
25 | + |
|
26 | +# SBGrid 'careless' title - run examples |
|
27 | +# Args: none |
|
28 | +# |
|
29 | +# James Vincent - biogrids.org |
|
30 | +# vincent@hkl.hms.harvard.edu |
|
31 | +# Jan 20, 2023 |
|
32 | + |
|
33 | +# Sample SLURM submission |
|
34 | + |
|
35 | +#SBATCH --partition=mghpcc-gpu |
|
36 | +#SBATCH --gres=gpu:NVIDIA_A40:1 |
|
37 | +#SBATCH --time=03:00:00 |
|
38 | +#SBATCH --job-name=jjv5-101051_careless |
|
39 | +#SBATCH --mail-type=BEGIN,END,FAIL |
|
40 | + |
|
41 | +# Load cuda |
|
42 | +module load cuda/11.2 |
|
43 | + |
|
44 | +# Set my_cuda_dir to your local install |
|
45 | +my_cuda_dir="/programs/local/cuda/11.2" |
|
46 | +export XLA_FLAGS=--xla_gpu_cuda_data_dir=${my_cuda_dir} |
|
47 | + |
|
48 | +# Start SBGrid environment |
|
49 | +source /programs/sbgrid.shrc |
|
50 | + |
|
51 | + |
|
52 | +# Get 'careless' examples |
|
53 | +curl -kLO https://github.com/rs-station/careless-examples/archive/main.zip |
|
54 | +unzip main.zip |
|
55 | + |
|
56 | +# pyp example - approx 14min on NVIDIA_A40 |
|
57 | +cd careless-examples-main/pyp |
|
58 | +time ./merge.sh |
|
59 | +cd ../.. |
|
60 | + |
|
61 | +# little_careless example - approx 1.5min on NVIDIA_A40 |
|
62 | +cd careless-examples-main/little_careless |
|
63 | +time python.careless model.py |
|
64 | +cd ../.. |
|
65 | + |
|
66 | +# hewl_ssad example - approx 20min on NVIDIA_A40 |
|
67 | +cd careless-examples-main/hewl_ssad |
|
68 | +time ./merge.sh |
|
69 | +cd ../.. |
|
70 | + |
|
71 | +# thermolysin_xfel example - approx 33min on NVIDIA_A40 |
|
72 | +cd careless-examples-main/thermolysin_xfel |
|
73 | +time ./merge.sh |
|
74 | +cd ../.. |
|
75 | + |
|
76 | +# little_careless example - approx 1min on NVIDA_A40 |
|
77 | +cd careless-examples-main/careless_zero |
|
78 | +time python.careless ./careless_zero.py |
|
79 | +cd ../.. |
|
80 | + |
|
81 | +exit |
|
82 | + |
|
83 | + |
|
84 | +# Verify we have a working GPU |
|
85 | +echo -e "hostname: $HOSTNAME \n\n" |
|
86 | +echo -e "nvidia-smi output \n\n" |
|
87 | +nvidia-smi |
|
88 | + |
|
89 | +# Verify TF works: |
|
90 | +echo -e "\n\n Testing TF with python.careless: " |
|
91 | +python.careless -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))" |
|
92 | + |
|
93 | +# Verify GPU: |
|
94 | +echo -e "\n\n Testing GPU with python.careless: " |
|
95 | +python.careless -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))" |
|
96 | + |
|
97 | +``` |
|
98 | + |
|
99 | + |