Skip to main content

compile

Under Construction

The English version of this document is under construction and will be available soon.

確認目前載入的編譯器種類

which mpicc

編譯程式

mpicc -o hello /opt/ohpc/pub/examples/mpi/hello.c

取得Slurm資源

salloc -N 4 -n 4 -p gtest

編寫執行環境內容(可參考/opt/ohpc/pub/examples/slurm/job.mpi )

cat job.mpi
#!/bin/bash

#SBATCH -J test # Job name
#SBATCH -o job.%j.out # Name of stdout output file (%j expands to jobId)
#SBATCH -N 2 # Total number of nodes requested
#SBATCH -n 16 # Total number of mpi tasks requested
#SBATCH -t 01:30:00 # Run time (hh:mm:ss) - 1.5 hours
#Launch MPI-based executable
srun ./hello

執行程式

sbatch job.mpi

查看執行輸出結果

cat job.3718.out

GPU測試程式編輯

# gpu.sh for GPU Resource Test
cat gpu.sh
#!/bin/bash
#SBATCH --ntasks 1 # number of tasks
#SBATCH -p SlurmDefault # queue
#SBATCH --mem 1024 # memory pool per process
#SBATCH -o slurm.%N.%j.out # STDOUT
#SBATCH -t 0:05:00 # time (D-HH:MM)
#SBATCH --gres=gpu:8
nvidia-smi

執行GPU測試程式

sbatch gpu.sh

查看執行輸出結果

cat slurm.gn0103.3732.out