Skip to content

Commit

Permalink
Merge pull request #46 from deepmodeling/devel-1.0
Browse files Browse the repository at this point in the history
1.0.2-compatible with Bohrium App
  • Loading branch information
kevinwenminion authored Oct 16, 2023
2 parents db85a7c + 659833c commit f138d81
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 40 deletions.
2 changes: 1 addition & 1 deletion apex/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
__version__ = '1.0.1'
__version__ = '1.0.2'
LOCAL_PATH = os.getcwd()


Expand Down
2 changes: 1 addition & 1 deletion apex/core/property/EOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import apex.core.calculator.lib.abacus as abacus
import apex.core.calculator.lib.vasp as vasp
import apex.core.calculator.lib.abacus_scf as abacus_scf
from apex.core.Property import Property
from apex.core.property.Property import Property
from apex.core.refine import make_refine
from apex.core.reproduce import make_repro, post_repro
from dflow.python import upload_packages
Expand Down
2 changes: 1 addition & 1 deletion apex/core/property/Elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import apex.core.calculator.lib.abacus as abacus
import apex.core.calculator.lib.vasp as vasp
import apex.core.calculator.lib.abacus_scf as abacus_scf
from apex.core.Property import Property
from apex.core.property.Property import Property
from apex.core.refine import make_refine
from apex.core.calculator.lib.vasp import incar_upper
from dflow.python import upload_packages
Expand Down
2 changes: 1 addition & 1 deletion apex/core/property/Gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import apex.core.calculator.lib.abacus as abacus
import apex.core.calculator.lib.vasp as vasp
from apex.core.Property import Property
from apex.core.property.Property import Property
from apex.core.refine import make_refine
from apex.core.reproduce import make_repro, post_repro
from apex.core.structure import StructureInfo
Expand Down
3 changes: 1 addition & 2 deletions apex/core/property/Interstitial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
import os
import re
import copy

import numpy as np
from monty.serialization import dumpfn, loadfn
Expand All @@ -12,7 +11,7 @@

import apex.core.calculator.lib.abacus as abacus
import apex.core.calculator.lib.lammps as lammps
from apex.core.Property import Property
from apex.core.property.Property import Property
from apex.core.refine import make_refine
from apex.core.reproduce import make_repro, post_repro
from apex.core.structure import StructureInfo
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apex/core/property/Surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import apex.core.calculator.lib.abacus as abacus
import apex.core.calculator.lib.vasp as vasp
from apex.core.Property import Property
from apex.core.property.Property import Property
from apex.core.refine import make_refine
from apex.core.reproduce import make_repro, post_repro
from dflow.python import upload_packages
Expand Down
2 changes: 1 addition & 1 deletion apex/core/property/Vacancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pymatgen.core.structure import Structure

import apex.core.calculator.lib.abacus as abacus
from apex.core.Property import Property
from apex.core.property.Property import Property
from apex.core.refine import make_refine
from apex.core.reproduce import make_repro, post_repro
from dflow.python import upload_packages
Expand Down
23 changes: 13 additions & 10 deletions apex/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ def _set_props_flow(
def submit_relax(
self,
work_dir: Union[os.PathLike, str],
relax_parameter: dict
relax_parameter: dict,
labels: Optional[dict] = None
):
wf = Workflow(name='relaxation')
wf = Workflow(name='relaxation', labels=labels)
relaxation = self._set_relax_flow(
input_work_dir=upload_artifact(work_dir),
relax_parameter=relax_parameter
Expand All @@ -177,14 +178,15 @@ def submit_relax(
def submit_props(
self,
work_dir: Union[os.PathLike, str],
props_parameter: dict
props_parameter: dict,
labels: Optional[dict] = None
):
wf = Workflow(name='property')
property = self._set_props_flow(
wf = Workflow(name='property', labels=labels)
properties = self._set_props_flow(
input_work_dir=upload_artifact(work_dir),
props_parameter=props_parameter
)
wf.add(property)
wf.add(properties)
wf.submit()
self.download(
wf, step_name='property-cal',
Expand All @@ -197,19 +199,20 @@ def submit_joint(
self,
work_dir: Union[os.PathLike, str],
relax_parameter: dict,
props_parameter: dict
props_parameter: dict,
labels: Optional[dict] = None
):
wf = Workflow(name='joint')
wf = Workflow(name='joint', labels=labels)
relaxation = self._set_relax_flow(
input_work_dir=upload_artifact(work_dir),
relax_parameter=relax_parameter
)
property = self._set_props_flow(
properties = self._set_props_flow(
input_work_dir=relaxation.outputs.artifacts["output_all"],
props_parameter=props_parameter
)
wf.add(relaxation)
wf.add(property)
wf.add(properties)
wf.submit()
self.download(
wf, step_name='property-cal',
Expand Down
44 changes: 26 additions & 18 deletions apex/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .flow import FlowFactory



def judge_flow(parameter, specify) -> (Type[OP], str, str, dict, dict):
# identify type of flow and input parameter file
num_args = len(parameter)
Expand Down Expand Up @@ -81,40 +80,49 @@ def judge_flow(parameter, specify) -> (Type[OP], str, str, dict, dict):
return run_op, task_type, flow_type, relax_param, props_param


def submit(flow,
flow_type,
work_dir,
relax_param,
props_param,
conf=config,
s3_conf=s3_config):
def submit(
flow,
flow_type,
work_dir,
relax_param,
props_param,
conf=config,
s3_conf=s3_config,
labels=None,
):
# reset dflow global config for sub-processes
config.update(conf)
s3_config.update(s3_conf)

if flow_type == 'relax':
flow.submit_relax(
work_dir=work_dir,
relax_parameter=relax_param
relax_parameter=relax_param,
labels=labels
)
elif flow_type == 'props':
flow.submit_props(
work_dir=work_dir,
props_parameter=props_param
props_parameter=props_param,
labels=labels
)
elif flow_type == 'joint':
flow.submit_joint(
work_dir=work_dir,
props_parameter=props_param,
relax_parameter=relax_param
relax_parameter=relax_param,
labels=labels
)


def submit_workflow(parameter,
config_file,
work_dir,
flow_type,
is_debug=False):
def submit_workflow(
parameter,
config_file,
work_dir,
flow_type,
is_debug=False,
labels=None
):
try:
config_dict = loadfn(config_file)
except FileNotFoundError:
Expand Down Expand Up @@ -179,11 +187,11 @@ def submit_workflow(parameter,
for ii in work_dir_list:
res = pool.apply_async(
submit,
(flow, flow_type, ii, relax_param, props_param, config, s3_config)
(flow, flow_type, ii, relax_param, props_param, config, s3_config, labels)
)
pool.close()
pool.join()
elif len(work_dir_list) == 1:
submit(flow, flow_type, work_dir_list[0], relax_param, props_param)
submit(flow, flow_type, work_dir_list[0], relax_param, props_param, labels=labels)

print('Completed!')
2 changes: 1 addition & 1 deletion examples/abacus_demo/global_bohrium.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"email": "YOUR_EMAIL",
"password": "YOUR_PASSWD",
"program_id": 1234,
"apex_image_name":"registry.dp.tech/dptech/prod-11045/apex-dependencies:1.0.0",
"apex_image_name":"registry.dp.tech/dptech/prod-11045/apex-dependency:1.0",
"abacus_image_name":"registry.dp.tech/dptech/prod-11461/abacus:phonopy",
"abacus_run_command":"ulimit -s unlimited && ulimit -m unlimited && OMP_NUM_THREADS=1 mpirun -np 32 abacus > log",
"batch_type": "Bohrium",
Expand Down
2 changes: 1 addition & 1 deletion examples/lammps_demo/global_bohrium.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"email": "YOUR@EMAIL",
"password": "YOURPASSWD",
"program_id": 1234,
"apex_image_name":"registry.dp.tech/dptech/prod-11045/apex-dependencies:1.0.0",
"apex_image_name":"registry.dp.tech/dptech/prod-11045/apex-dependency:1.0",
"lammps_image_name": "registry.dp.tech/dptech/prod-11045/deepmd-kit:deepmd-kit2.1.1_cuda11.6_gpu",
"group_size": 2,
"pool_size": 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/vasp_demo/global_bohrium.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"password": "YOUR_PASSWD",
"program_id": 1234,
"group_size": 2,
"apex_image_name":"registry.dp.tech/dptech/prod-11045/apex-dependencies:1.0.0",
"apex_image_name":"registry.dp.tech/dptech/prod-11045/apex-dependency:1.0",
"vasp_image_name":"registry.dp.tech/dptech/vasp:5.4.4-dflow",
"vasp_run_command":"bash -c \"source /opt/intel/oneapi/setvars.sh && ulimit -s unlimited && mpirun -n 32 /opt/vasp.5.4.4/bin/vasp_std \"",
"batch_type": "Bohrium",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="apex-flow",
version="1.0.1",
version="1.0.2",
author="Zhuoyuan Li, Tongqi Wen",
author_email="zhuoyli@outlook.com",
description="Alloy Properties EXplorer using simulations",
Expand Down

0 comments on commit f138d81

Please sign in to comment.