-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the PatternDrivenPlans wiki!
In this page we show how to use a new multiscale application for PDP
.
First of all, create two xml files; one for the single-scale and the other for multi-scale definitions.
single-scale applications definitions
Under this file, there is a number of tags:
submodels
Here, we specify the information the the application
- id: one word description of the application (accronym)
- name: human readable name
submodel
In this tag, you can define a number of instances for a submodel.
- class: can be 'MPIKernel' or 'NativeKernel'
- id: instance id.
- type: can be either kernel or helper
restrictions
The computational requirements are specifies here.
- number: can be a number 1, N/A, x or expression like 2**x
- min, max: are the minimum and maximum number of x in expression or the full range in N/A.
- <available_resources>
- name: name of the resource; can be either supermuc or eagle.
- nodeType: name of the node; for supermuc choose [thin, fat] , for eagle [haswell_64, haswell_128, haswell_256].
multi-scale application definitions
info
- appID: one word description of the application (accronym) ((like the submodels id))
- project: compat
- computing: the type of computing pattern; if this is left empty the computing pattern will be detected automatically.
- modeltime: total time of the model (use the instances and operations like + and max); if this is left empty the computing pattern will be detected automatically.
- numberofcores: minimum and maximum number of multiscale application cores for this run.
topology
In this tag, the topology of the multi-scale application is specified according to MML
- instances: define one instance for each submodel.
- coupling: use the coupling topology from ...
middleware
The middleware used. Here we use QCG.
- name of the middleware "QCG"
- type: compat for more information of the directives, look at QCG_manual
In the same folder as matrix.xml and multiscale.xml, you should create your application module. In this module, you can specify how the runtime, energy and/or efficiency are calculated. Also in this file, you specify the important parameters, how to obtain them and what is the scale factor.
First of all, the PDP generate a number of execution scinarios. Theses execution scienarios are based on different configurations of single-scale models that compose a multi-scale application. Then, the scienarios are ordered based on the criteria requested by the user and converted to execution plan to submit to the middleware.
The only addition to the muscle file cxa is to add:
k1['mpiexec_command']='map_kernel'
k1['mpiexec_args']='--profile mpiexec -np '+ ENV["QCG_KERNEL_K1"]
For each MPIKernel used.
In the first line, we used map_kernel
wrap instead of mpi_exec
. In the second line, the number of cores in the arguments is taken form the chosen execution plan.
To start your multi-scale application to use the patterns, then you also have to include the project model. The project module is a python .py
file with the name of application in upper case, e.g., ISR.py.
The module file is template to contain the following generic functions:
This function is responsible of collecting the application information w.r.t used profiler.
First of all, define the name of the kernels as they excuted, i.e. the name in the profiler.
map_kernel_names = ["SMCController", "FlowController"]
The name you gave in the application, i.e. the name in the multiscale.xml
core_kernel_names = ["smc","bf"]
Then, decide whether it is kernel "k" or helper "h". DEFINE kernel AND helpers
map_kernel_type = ["k","k"]
Define the input file name, per single-scale, if exist.
xmlfiles = ["",""]
In this function, we collect all the parameters. There are two types of parameters; global parameter(s), which effect all the single-scale models. The other type is the local parameter, which scales a single-scale model only.
To define the global parameter, for MUSCLE applications for example, we use find_cxa_value function and assign this to parameter variable as follows:
sample['global_steps'] = find_cxa_value(string, "max_timesteps")
Now, for each single scale, we define the local parameter as:
if kname == "FlowController":
sample['T'] = find_cxa_value(string, "bf:T")
sample['dt'] = find_cxa_value(string, "bf:dt")
sample['convergence'] = find_cxa_value(string, "bf:convergence_limit")
In this example, for the kernel "FlowController", we defined three local parameters "T", "dt" and "convergence_limit". These global and local parameters will be used in the database for interpolation and evaluation.
Here, you have to define how the global scale is calculated. For example: if the global scale is expression like "25 * 200 * 200", then it would be calculated as:
eval(params['global_steps'])
or if is a result of calculation based on parameters captured in get_parameters, then:
float(params['its_stop']) - float(params['its_start'])
In this function, you specify how the total time of the multi-scale application is calculated. The default is to use the model time expression in the multiscale.xml. In this example, we will take the k1 and k2 of multiscale application.
for j in xrange( 0,len(kernelNames) ):
`exec("%s = %f" % (kernelNames[j],float(fdss[j][0]['kernel_time'])))`
s.setSubmodelsTimes([k1, k2])
This by default take the names (as you assign in multiscale.xml) and assign the cpu time for each. Then the (default) run time calculated as:
total_time = eval(model_time)
If you would like to change the total_time calculations, you can use expressions like k1 + k2. Finally set this value as:
s.setTotalTime(total_time)
In the same way you can use both calc_energy and calc_eff to calculate the energy and efficiency respectively.