Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MNIST Slurm Demo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Slurm Projects
MNIST Slurm Demo
Commits
fead3904
Commit
fead3904
authored
Mar 07, 2019
by
Eamonn Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Pipeline
#1938
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
.gitignore
.gitignore
+1
-0
README.md
README.md
+67
-0
mnist-job.sh
mnist-job.sh
+9
-0
mnist.py
mnist.py
+18
-0
No files found.
.gitignore
0 → 100644
View file @
fead3904
*.log
README.md
0 → 100644
View file @
fead3904
# Slurm
Slurm is a workload manager, it runs on:
`slurm.doc.gold.ac.uk`
. Slurm
can be accessed via ssh using your usual college credentials – the
same as for igor.
To run your code on a GPU compute node you first need to copy all of
your code to your DOC shared home directory and then submit it as a
job to Slurm.
For example, to run this demo, ssh into
`slurm.doc.gold.ac.uk`
and
clone this repository.
```
sh
ssh <user>@slurm.doc.gold.ac.uk
git clone https://gitlab.doc.gold.ac.uk/slurm/mnist-slurm-demo.git
cd
mnist-slurm-demo
sbatch mnist-job.sh
# This command submits the job.
```
Slurm will schedule your job immediately when resources become
available.
## Example batch script
```
sh
#!/bin/sh
#SBATCH --time 4 # time in minutes to reserve
#SBATCH --cpus-per-task 2 # number of cpu cores
#SBATCH --mem 4G # memory pool for all cores
#SBATCH --gres gpu:1 # number of gpu cores
#SBATCH -o mnist.log # write output to log file
# Run jobs using the srun command.
srun
-l
python mnist.py
```
# Useful commands
See the
[
documentation
](
https://slurm.schedmd.com
)
for more
information.
## Submitting jobs
```
sh
sbatch mnist-job.sh
```
## Show information about a running job
Replace
`<n>`
below with your job id.
```
sh
sstat <n>
```
## Show information about all submitted jobs
```
sh
sacct
```
## Show specific information about a job
```
sh
sacct
--units
G
--format
=
jobid,avecpu,alloccpus,avevmsize
-j
<n>
```
mnist-job.sh
0 → 100644
View file @
fead3904
#!/bin/sh
#SBATCH --time 4 # time in minutes to reserve
#SBATCH --cpus-per-task 2 # number of cpu cores
#SBATCH --mem 4G # memory pool for all cores
#SBATCH --gres gpu:1 # number of gpu cores
#SBATCH -o mnist.log # write output to log file
# Run jobs using the srun command.
srun
-l
python mnist.py
mnist.py
0 → 100644
View file @
fead3904
import
tensorflow
as
tf
mnist
=
tf
.
keras
.
datasets
.
mnist
(
x_train
,
y_train
),
(
x_test
,
y_test
)
=
mnist
.
load_data
()
x_train
,
x_test
=
x_train
/
255.0
,
x_test
/
255.0
model
=
tf
.
keras
.
models
.
Sequential
([
tf
.
keras
.
layers
.
Flatten
(
input_shape
=
(
28
,
28
)),
tf
.
keras
.
layers
.
Dense
(
512
,
activation
=
tf
.
nn
.
relu
),
tf
.
keras
.
layers
.
Dropout
(
0.2
),
tf
.
keras
.
layers
.
Dense
(
10
,
activation
=
tf
.
nn
.
softmax
)
])
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
model
.
fit
(
x_train
,
y_train
,
epochs
=
5
)
print
(
'Evaluation:'
,
model
.
evaluate
(
x_test
,
y_test
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment