-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from Cloudac7/lsf
Update LSF module to keep consistent with DPDispatcher
- Loading branch information
Showing
5 changed files
with
91 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,49 @@ | ||
import os | ||
import sys | ||
import json | ||
from dpdispatcher.submission import Submission, Job, Task, Resources | ||
from dpdispatcher.machine import Machine | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | ||
|
||
from dpdispatcher.ssh_context import SSHSession, SSHContext | ||
from dpdispatcher.submission import Submission, Task, Resources | ||
from dpdispatcher.lsf import LSF | ||
|
||
# edit ssh parameters | ||
ssh_session = SSHSession( | ||
hostname='127.0.0.1', | ||
port=22, | ||
remote_root='/home/dp/dpdispatcher/tests', | ||
username='debug' | ||
) | ||
# local_root is the relevant path that containing tasks to be submit | ||
ssh_context = SSHContext(local_root='test_lsf_dir', ssh_session=ssh_session) | ||
lsf = LSF(context=ssh_context) | ||
|
||
prepend_text = ''' | ||
module load cuda/9.2 | ||
module load gcc/4.9.4 | ||
module load deepmd/1.0 | ||
source /home/dp/scripts/avail_gpu.sh | ||
''' | ||
# task_need_resources has no effect | ||
with open("jsons/machine_lsf.json", 'r') as f: | ||
mdata = json.load(f) | ||
|
||
lsf_bsub_dict = { | ||
'R': "'select[hname != g005]'" | ||
} | ||
resources = Resources( | ||
number_node=1, | ||
cpu_per_node=4, | ||
gpu_per_node=0, | ||
queue_name="gpu", | ||
walltime="24:00:00", | ||
prepend_text=prepend_text, | ||
append_text="", | ||
gpu_usage=False, | ||
gpu_new_syntax=False, | ||
extra_specification=lsf_bsub_dict, | ||
group_size=1 | ||
) | ||
machine = Machine.load_from_dict(mdata['machine']) | ||
resources = Resources.load_from_dict(mdata['resources']) | ||
|
||
# task_need_resources has no effect | ||
submission = Submission( | ||
work_base='0_md', # the dir containing all of task_work_path | ||
resources=resources, # resources above | ||
forward_common_files=['graph.pb'], # file to be upload | ||
backward_common_files=['*.json'] # file to be downloaded | ||
work_base='0_md/', | ||
machine=machine, | ||
resources=resources, | ||
forward_common_files=['graph.pb'], | ||
backward_common_files=[] | ||
) | ||
|
||
task1 = Task( | ||
command='lmp_mpi_20201029 -i input.lammps', | ||
task_work_path='bct-1', | ||
command='lmp -i input.lammps', | ||
task_work_path='bct-1/', | ||
forward_files=['conf.lmp', 'input.lammps'], | ||
backward_files=['log.lammps'], | ||
backward_files=['log.lammps'] | ||
) | ||
task2 = Task( | ||
command='lmp_mpi_20201029 -i input.lammps', | ||
task_work_path='bct-2', | ||
command='lmp -i input.lammps', | ||
task_work_path='bct-2/', | ||
forward_files=['conf.lmp', 'input.lammps'], | ||
backward_files=['log.lammps'], | ||
backward_files=['log.lammps'] | ||
) | ||
task3 = Task( | ||
command='lmp_mpi_20201029 -i input.lammps', | ||
task_work_path='bct-3', | ||
command='lmp -i input.lammps', | ||
task_work_path='bct-3/', | ||
forward_files=['conf.lmp', 'input.lammps'], | ||
backward_files=['log.lammps'], | ||
backward_files=['log.lammps'] | ||
) | ||
task4 = Task( | ||
command='lmp_mpi_20201029 -i input.lammps', | ||
task_work_path='bct-4', | ||
command='lmp -i input.lammps', | ||
task_work_path='bct-4/', | ||
forward_files=['conf.lmp', 'input.lammps'], | ||
backward_files=['log.lammps'], | ||
backward_files=['log.lammps'] | ||
) | ||
submission.register_task_list([task1, task2, task3, task4, ]) | ||
submission.generate_jobs() | ||
submission.bind_batch(batch=lsf) | ||
|
||
submission.run_submission() | ||
submission.run_submission(clean=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"machine":{ | ||
"batch_type": "LSF", | ||
"context_type": "SSHContext", | ||
"local_root": "./test_lsf_dir", | ||
"remote_root": "/data/home/ypliu/dptasks", | ||
"remote_profile": { | ||
"hostname": "123.45.78.99", | ||
"port": 56789, | ||
"username": "ypliu" | ||
} | ||
}, | ||
"resources":{ | ||
"number_node": 1, | ||
"cpu_per_node": 4, | ||
"gpu_per_node": 1, | ||
"queue_name": "gpu", | ||
"group_size": 4, | ||
"custom_flags": [ | ||
"#BSUB -R \"select[hname != g005]\"", | ||
"#BSUB -W 24:00" | ||
], | ||
"strategy": { | ||
"if_cuda_multi_devices": false | ||
}, | ||
"para_deg": 1, | ||
"module_unload_list": [], | ||
"module_list": [ | ||
"use.own", | ||
"deepmd/1.3" | ||
], | ||
"source_list": [ | ||
"/data/home/ypliu/scripts/avail_gpu.sh", | ||
"/data/home/ypliu/dprun/tf_envs.sh" | ||
], | ||
"envs": {"DP_DISPATCHER_EXPORT": "test_foo_bar_baz"}, | ||
"kwargs": { | ||
"gpu_usage": false, | ||
"gpu_new_syntax": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../graph.pb |