Skip to content

Commit 920a1fc

Browse files
authored
Merge pull request #10 from pxlxingliang/develop
Develop
2 parents 887a336 + a7c7a4b commit 920a1fc

15 files changed

Lines changed: 843 additions & 825 deletions

src/abacustest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def AbacusTestArgs(parser):
1515
parser.description = "This script is used to run a testing"
1616
parser.add_argument('-p', '--param', type=str, default="job.json",help='the job setting file, default is job.json')
17-
parser.add_argument('-s', '--save', type=str, default=None,help='the folder where the results will be put in, default: result/date_of_today (e.g. result/20230101)')
17+
parser.add_argument('-s', '--save', type=str, default=None,help='the folder where the results will be put in, default: result')
1818
parser.add_argument('--override', type=int, default=1,help="when the save folder exists, if override it. 0: no, 1: yes. ")
1919
parser.add_argument('--outinfo', type=int, default=1,help='if output detail informations, 0: no, 1: yes')
2020
parser.add_argument('--debug',nargs='?',type=int, const=1, default=0,help="debug mode for dflow")

src/launching/comm_class.py

Lines changed: 44 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from dp.launching.cli import to_runner,SubParser,run_sp_and_exit
2-
from dp.launching.typing.basic import BaseModel, Int, String, Float,List,Optional,Union,Dict
3-
from dp.launching.cli import to_runner, default_minimal_exception_handler
1+
from dp.launching.typing.basic import BaseModel, Int, String, Float, List, Optional, Union, Dict
42
from dp.launching.typing import InputFilePath, OutputDirectory
53
from dp.launching.typing import (
64
BaseModel,
@@ -22,10 +20,12 @@
2220
BenchmarkLabels,
2321
BenchmarkTags
2422
)
25-
from enum import Enum
26-
from typing import Literal
23+
2724
import re
2825

26+
class OutputSet(BaseModel):
27+
IO_output_path: OutputDirectory = Field(default="./output")
28+
2929
class ConfigSet(BaseModel):
3030
#Bohrium config
3131
Config_lbg_username: BohriumUsername
@@ -36,102 +36,66 @@ class ConfigSet(BaseModel):
3636
Config_config_host: DflowArgoAPIServer
3737
Config_s3_config_endpoint: DflowStorageEndpoint
3838
Config_config_k8s_api_server: DflowK8sAPIServer
39-
Config_config_token: DflowAccessToken
39+
Config_config_token: DflowAccessToken
4040

4141
Config_dflow_labels: BenchmarkLabels
4242

43-
class AbacusMetricEnum(String,Enum):
44-
AbacusMetric_metric1 = 'version'
45-
AbacusMetric_metric2 = 'ncore'
46-
AbacusMetric_metric3 = 'normal_end'
47-
AbacusMetric_metric4 = 'INPUT:ks_solver'
48-
# AbacusMetric_metric5 = 'kpt'
49-
AbacusMetric_metric6 = 'nbands'
50-
AbacusMetric_metric7 = 'converge'
51-
AbacusMetric_metric8 = 'total_mag'
52-
AbacusMetric_metric9 = 'absolute_mag'
53-
AbacusMetric_metric10 = 'nkstot'
54-
AbacusMetric_metric11 = 'ibzk'
55-
AbacusMetric_metric12 = 'natom'
56-
AbacusMetric_metric13 = 'nelec'
57-
AbacusMetric_metric14 = 'energy'
58-
AbacusMetric_metric15 = 'volume'
59-
# AbacusMetric_metric16 = 'fft_grid'
60-
AbacusMetric_metric17 = 'efermi'
61-
AbacusMetric_metric18 = 'energy_per_atom'
62-
# AbacusMetric_metric19 = 'stress'
63-
# AbacusMetric_metric20 = 'force'
64-
AbacusMetric_metric21 = 'band_gap'
65-
AbacusMetric_metric22 = 'total_time'
66-
AbacusMetric_metric23 = 'stress_time'
67-
AbacusMetric_metric24 = 'force_time'
68-
AbacusMetric_metric25 = 'scf_time'
69-
AbacusMetric_metric26 = 'scf_time_each_step'
70-
AbacusMetric_metric27 = 'step1_time'
71-
AbacusMetric_metric28 = 'scf_steps'
72-
AbacusMetric_metric29 = 'atom_mag'
73-
# AbacusMetric_metric30 = 'drho'
74-
AbacusMetric_metric31 = 'lattice_constant'
75-
AbacusMetric_metric32 = 'cell'
76-
# AbacusMetric_metric33 = 'coordinate'
77-
AbacusMetric_metric34 = 'element_list'
78-
AbacusMetric_metric35 = 'atomlabel_list'
79-
# AbacusMetric_metric36 = 'delta_energy'
80-
# AbacusMetric_metric37 = 'delta_energyPerAtom'
81-
AbacusMetric_metric38 = 'relax_converge'
82-
AbacusMetric_metric39 = 'relax_steps'
83-
84-
85-
class SuperMetricMethodEnum(String,Enum):
86-
SuperMetricMethod_method1 = "iGM"
87-
SuperMetricMethod_method2 = "GM"
88-
SuperMetricMethod_method3 = "TrueRatio"
89-
SuperMetricMethod_method4 = "MEAN"
90-
91-
'''
92-
class RunSetUpload(BaseModel):
93-
uploaddatahub_project: String = Field(default="",description="Please set the project where dataset will be uploaded to. If not set, will not upload")
94-
uploaddatahub_datasetname: String = Field(default="",description="Please set the path in project where dataset will be uploaded to. If not set, will not upload")
95-
uploaddatahub_properties: Dict[String,String] = Field(default={},description="")
96-
uploaddatahub_tags: List[String] = Field(default=[],description="")
97-
uploadtracking_test_name: String = Field(default="",description="Please set the name of test. If not set, will not upload metrics to tracking")
98-
uploadtracking_experiment_name: String = Field(default="",description="Please set the name of experiment. If not set, will not upload metrics to tracking")
99-
uploadtracking_tags: List[String] = Field(default=[],description="")
100-
'''
43+
44+
class NgroupSet(BaseModel):
45+
ngroup: Int = Field(
46+
default=0, description="Number of groups to run in parallel. If not set, all examples will be run in parallel.", ge=0)
47+
48+
49+
class RundftCommandSet(BaseModel):
50+
rundft_command: String = Field(default="OMP_NUM_THREADS=1 mpirun -np 16 abacus > log",
51+
description="Command to run each example. Please note that the program will first enter each folder before executing this command. \
52+
During runtime, there will be no interaction between different examples",)
53+
54+
55+
class PostdftCommandSet(BaseModel):
56+
postdft_command: String = Field(default="",
57+
description="If you need to execute some custom scripts or commands, please enter the bash command here. \
58+
Usually used to generate some custom metrics. At this step, the program will first collect the results of all examples in rundft, and then execute the command. \
59+
The working directory is the same level directory as the outer layer of all examples.",)
60+
10161

10262
class TrackingSet(BaseModel):
103-
Tracking_metrics: Boolean = Field(default=False,description="If tracking, will display historical metrics values based on test and experience")
104-
Tracking_token: String = Field(default=None,description="If want to track metrics, please enter your token to access AIM")
63+
Tracking_metrics: Boolean = Field(
64+
default=False, description="If tracking, will display historical metrics values based on test and experience")
65+
Tracking_token: String = Field(
66+
default=None, description="If want to track metrics, please enter your token to access AIM")
10567
Tracking_tags: BenchmarkTags
10668
#tags = [f"benchmark-application-{application.name}", f"benchmark-version-{job.version}", f"benchmark-schedule-{job.properties.get('source_name', 'none')}",
10769
# f"benchmark-job-{job.name}"]
10870

10971
@classmethod
110-
def parse_obj(cls,opts):
111-
if opts.tracking_metrics and opts.tracking_token != None and opts.tracking_token.strip() != "":
112-
default_tags = opts.default_tags
113-
schedule = "_".join(re.split("-",default_tags[2],2)[-1].strip().split())
114-
application_name = re.split("-",default_tags[0],2)[-1]
115-
job_name = re.split("-",default_tags[3],2)[-1]
116-
72+
def parse_obj(cls, opts):
73+
if opts.Tracking_metrics and opts.Tracking_token != None and opts.Tracking_token.strip() != "":
74+
default_tags = opts.Tracking_tags
75+
schedule = "_".join(
76+
re.split("-", default_tags[2], 2)[-1].strip().split())
77+
application_name = re.split("-", default_tags[0], 2)[-1]
78+
job_name = re.split("-", default_tags[3], 2)[-1]
79+
11780
return {
11881
"name": schedule + "." + job_name,
11982
"experiment": application_name + "/benchmark",
12083
"tags": default_tags,
121-
"token": opts.tracking.AIM_ACCESS_TOKEN
84+
"token": opts.Tracking_token
12285
}
12386
else:
12487
return None
125-
88+
12689

12790
class myLog:
12891
def __init__(self):
12992
self.logs = ""
130-
131-
def iprint(self,mess,*args):
93+
94+
def iprint(self, mess, *args):
13295
allmess = " ".join([str(mess)]+[str(i) for i in args])
13396
print(allmess)
13497
self.logs += allmess + "\n"
135-
136-
def write(self,filename):
137-
with open(filename,'w') as f1: f1.write(self.logs)
98+
99+
def write(self, filename):
100+
with open(filename, 'w') as f1:
101+
f1.write(self.logs)

0 commit comments

Comments
 (0)