Giter VIP home page Giter VIP logo

cps_issp_sample's Introduction

CPSを物性研で使うサンプル

概要

手抜き馬鹿パラスケジューラ「Command Processor Scheduler (CPS)」を物性研で利用するためのサンプル。CPSのリポジトリはgithub.com/kaityo256/cps

使い方

準備

このリポジトリを--recursiveをつけてcloneする。

git clone --recursive https://github.com/kaityo256/cps_issp_sample.git

できたディレクトリのcps_issp_sample/cpsに入る。

cd cps_issp_sample
cd cps

cpsをビルドする。

make

cpsができたら上に戻る。

cd ..

インプットファイルseed?.datを作成する。

python3 makeseed.py

seed0.datからseed9.datができるはず。これでジョブを投入する準備ができた。

ジョブの投入

実行するタスクはtask.shに書いてある。

# tasks
python3 hello.py < seed0.dat > output0.dat
python3 hello.py < seed1.dat > output1.dat
python3 hello.py < seed2.dat > output2.dat
python3 hello.py < seed3.dat > output3.dat
python3 hello.py < seed4.dat > output4.dat
python3 hello.py < seed5.dat > output5.dat
python3 hello.py < seed6.dat > output6.dat
python3 hello.py < seed7.dat > output7.dat
python3 hello.py < seed8.dat > output8.dat
python3 hello.py < seed9.dat > output9.dat

それぞれのジョブは5秒かかる。これを10並列で実行するジョブスクリプトがjob.sh

#!/bin/sh

#SBATCH -p i8cpu
#SBATCH -N 1
#SBATCH -n 11

srun ./cps/cps task.sh

これはテストなのでi8cpuを使っているが、プロダクトランを投げる時にはF1cpuキューなどに投げること。ノード数は1(-N 1)、プロセス数は11 (-n 11)としている。CPSは管理のために1プロセス使うので、ジョブスクリプトに書いたプロセス数-1が並列実行される。

このジョブを投入するにはsbatchを用いる。

sbatch job.sh

実行終了後、以下のようなcps.logが出力されたら成功。

Number of tasks : 10
Number of processes : 11
Total execution time: 50.611 [s]
Elapsed time: 5.073 [s]
Parallel Efficiency : 0.997654

Task list:
Command : Elapsed time
python3 hello.py < seed0.dat > output0.dat : 5.063 [s]
python3 hello.py < seed1.dat > output1.dat : 5.056 [s]
python3 hello.py < seed2.dat > output2.dat : 5.071 [s]
python3 hello.py < seed3.dat > output3.dat : 5.056 [s]
python3 hello.py < seed4.dat > output4.dat : 5.055 [s]
python3 hello.py < seed5.dat > output5.dat : 5.056 [s]
python3 hello.py < seed6.dat > output6.dat : 5.071 [s]
python3 hello.py < seed7.dat > output7.dat : 5.056 [s]
python3 hello.py < seed8.dat > output8.dat : 5.071 [s]
python3 hello.py < seed9.dat > output9.dat : 5.056 [s]

これは、10個のタスクを11プロセス(管理プロセスを除くト10プロセス)で実行し、ほぼ同時にすべてのジョブを実行できたため、並列化効率が100%近かった(99.8%)ことを示している。

使用上の注意

このリポジトリではCPSをGitのサブモジュールとして利用しているが、特にそうする必要はない。例えば別にビルドしたcpsの実行バイナリがあるなら、それをプロジェクトのディレクトリにコピーして、ジョブスクリプトを

#!/bin/sh

#SBATCH -p i8cpu
#SBATCH -N 1
#SBATCH -n 11

srun ./cps task.sh

としても良い。task.shにはいくらでもジョブを並べて良いが、MPIプログラムを実行することはできない。また、スレッド並列をしている場合もおかしなことになるであろう。

ライセンス

MIT

cps_issp_sample's People

Contributors

kaityo256 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.