Professional Documents
Culture Documents
Poznan Supercomputing and Networking Center, IChB PAS, Noskowskiego 12/14, 61-704 Poznan, Poland
Aix Marseille Universit, CNRS, Centrale Marseille, M2P2 UMR 7340, 13451, Marseille, France
article
info
Article history:
Received 6 August 2015
Received in revised form
16 October 2015
Accepted 10 November 2015
Available online 1 December 2015
Keywords:
Multi-physics workflow engine
Optimization framework
Code coupling
DEMO fusion reactor design
abstract
A generic coupling method between a multi-physics workflow engine and an optimization framework is
presented in this paper. The coupling architecture has been developed in order to preserve the integrity
of the two frameworks. The objective is to provide the possibility to replace a framework, a workflow
or an optimizer by another one without changing the whole coupling procedure or modifying the main
content in each framework. The coupling is achieved by using a socket-based communication library for
exchanging data between the two frameworks. Among a number of algorithms provided by optimization
frameworks, Genetic Algorithms (GAs) have demonstrated their efficiency on single and multiple criteria
optimization. Additionally to their robustness, GAs can handle non-valid data which may appear during
the optimization. Consequently GAs work on most general cases. A parallelized framework has been
developed to reduce the time spent for optimizations and evaluation of large samples. A test has shown
a good scaling efficiency of this parallelized framework. This coupling method has been applied to the
case of SYCOMORE (SYstem COde for MOdeling tokamak REactor) which is a system code developed in
form of a modular workflow for designing magnetic fusion reactors. The coupling of SYCOMORE with the
optimization platform URANIE enables design optimization along various figures of merit and constraints.
2015 EURATOM. Published by Elsevier B.V. All rights reserved.
1. Introduction
Generic purpose workflow engines can be used to solve physics
problems involving a number of coupled modular components.
These generic purpose workflow engines usually lack numerical optimization tools, which are instead embedded in dedicated
optimization frameworks. This work presents a generic coupling
method between a multi-physics workflow engine and an optimization framework, thus enabling the optimization of complex
simulations integrating potentially a large number of workflow
components. This method has been successfully applied to the optimization of fusion reactor design.
Corresponding author.
E-mail address: luc.digallo@cea.fr (L. Di Gallo).
http://dx.doi.org/10.1016/j.cpc.2015.11.002
0010-4655/ 2015 EURATOM. Published by Elsevier B.V. All rights reserved.
The main objective is preserving the integrity of both frameworks. The solution is to separate them as much as possible in order to run them independently. They are coupled by an exchange
of data as it is illustrated in Fig. 1. One waits for the data coming from the other to run and send its results to the other. Each
framework sees the other one as a black box. The data communication is performed by a socket-based communication library called
KUI (KEPLERURANIE Interface) which we have developed for this
purpose. Instead of a tight integration, the two frameworks remain loosely coupled with this socket-based communication. This
coupling architecture allows thus to replace easily any scientific
workflow or optimization algorithm by another one. Moreover, optimizer frameworks or workflow engines can be changed without
affecting the coupling procedure.
Software and tools for both frameworks have been chosen for
their simplicity of use and their adaptability to any physics context.
The workflow engine chosen for the multi-physics framework is
77
Fig. 1. The system code SYCOMORE for DEMO designing is coupled with the
URANIE platform by using the socket-based communication library KUI.
78
79
80
with files that are already being written by the process at another
moment. For instance, the optimizer will wait for the data coming
from SYCOMORE instead of reading a file which may have already
been filled during a previous iteration. Therefore, the reception of
a message itself is a signal to start the computation. So, no more
signals are required.
The user specifies the number of desired input/output and
which variables these correspond in a list. The range of study for
inputs is fixed during this parametrization. For the moment, these
parameters are written in a file which is read just once at the
initialization of SYCOMORE. But a graphical user interface for this
parametrization is under development to simplify this operation.
KUI is structured in 5 classes as shown in Fig. 5. The first
top class which is inherited by all other classes contains the
basic declaration for sockets such as the domain, the type and
the protocol. The domain, which defines the address family, is
configured by default in KUI to AF_UNIX. This socket family is
used to communicate between processes on the same machine
efficiently. It is a local communication. The socket type configured
by default is SOCK_STREAM. This socket type is full-duplex byte
streams which ensure that data is neither lost nor duplicated.
Only a single protocol exists for the AF_UNIX domain which is
specified to 0. A few preconfigured error messages are declared in
this class too. The next two classes are the receiving and sending
classes. Both inherit the top class and proceed in two steps. The
size of the message is sent/received first. Then the message itself,
written as a character array is sent/received. The next two classes,
which inherit both receiving and sending classes, correspond to the
declaration of the socket server and socket client.
KUI is implemented in two Kepler actors (components), one
at the beginning of the global SYCOMORE loop to receive values
of input variables and one at the end of the loop to send values
of output variables (Fig. 4). These two SYCOMORE components
are configured to work with two separate channels. Instead of
using the same socket for sending and receiving data, SYCOMORE
uses two server sockets created by the external tool (URANIE) at
each exchange. The creation of a socket at each exchange prevents
blocking the global SYCOMORE loop for the next step in case of
malfunction.
These two actors proceed to a conversion of characters into
numbers and vice versa. All double precision numbers and all
integers are converted into characters and concatenated into one
string chain before sending the message. The opposite operation is
done after the reception of a message. There is also a final control of
data validity and remaining special values such as infinite values or
NaN are replaced by the 1.0 value and the validity flag mentioned
above is set to error flag.
81
KEPLER assumes that all internal data are stored inside three
dedicated directories. So, starting multiple Kepler sessions would
overwrite data and try to use the same HSQL database. A specific
method has thus to be developed to bypass such KEPLER internal
blocking. The method adopted here for the parallelization is
based on the virtual duplication of the KEPLER environment by
using a wrapper which separates data involved in workflows. All
environment variables, files required by KEPLER (e.g. environment
variable description) and links to the KEPLER executable are
copied in directories especially created for each parallel job.
Directories where to put all files generated by each KEPLER session
(e.g. log files or internal data stored in files) are also created.
This allows thus starting several identical workflows in parallel
without any internal blocking. The wrapper works in two steps,
it first duplicates the KEPLER environment and then launches the
SYCOMORE run on KEPLER.
URANIE has been designed to handle parallelized jobs [22]. All
parallel sessions of URANIE start using MPI. The first process is
allocated to the URANIE master and executes algorithms such
as an optimizer. The other processes launched in parallel are
allocated to URANIE slaves and they execute external codes for
each evaluation. The master handles the gathering of computed
data by slaves.
The solution adopted with URANIE to do optimizations,
samplings and sensitivity studies of SYCOMORE using parallel
sessions is presented in Fig. 6. In our case, parallel sessions of
SYCOMORE are launched just once at the initialization and remain
active until the end of the whole job. Thus, URANIE slaves only
have to handle the exchange of data with the external parallel
sessions of SYCOMORE. This has required modifying the source
code of URANIE slaves.
Except for the URANIE master, each URANIE slave and associated workflow sessions (e.g. SYCOMORE session) are launched
on the same processor. As it is shown in Fig. 6, this configuration
requires the same number of parallel sessions for URANIE as SYCOMORE sessions plus one (for the URANIE master process). This
procedure is managed by a script which launches URANIE and
SYCOMORE wrapper on parallel processors using MPI. A qsub command starts this script which submits batch jobs with the desired
number of processors.
Different socket names, defined in the parallel job script are
created in order to get separate channels of communication for
each SYCOMORE session. Socket names are passed to SYCOMORE
and URANIE by environment variables.
This level of parallelization allows achieving independent
SYCOMORE evaluations. The simplicity of the URANIE slave jobs
which mainly have to exchange data with SYCOMORE does not
82
Table 1
Scaling study of the parallelization by varying the number of parallel sessions (N)
from 255 to 3. Tev al is the averaged time spent for one SYCOMORE evaluation per
session. Using the extended Amdahls law the time that would be spent on one
processor to achieve that sampling is time(1) = 11.37 h.
N
Nbr of processors
Tev al
255
127
95
63
47
31
27
23
19
15
11
7
3
256
128
96
64
48
32
28
24
20
16
12
8
4
4 min 56
7 min 53 s
11 min 09 s
13 min 26 s
17 min 30 s
23 min 27 s
53 min 20 s
1 h 02 min 37 s
1 h 15 min 47 s
48 min 36 s
2 h 10 min 55 s
1 h 38 min 32 s
3 h 58 min 52 s
8.4 s
6.0 s
5.3 s
5.1 s
4.9 s
4.4 s
4.3 s
4.2 s
4.2 s
4.4 s
4.0 s
4.1 s
4.1 s
P
time(N ) = time(1) (1 P ) +
+ N
(1)
is the additional serial time spent doing things like interprocessor communications. The fit of the points with the extended
Amdahls law gives a good scaling efficiency of P = 0.9980. The
time that would be spent on one processor to achieve that sampling is time(1) = 11.37 h. The inter-processor communications
coefficient is = 1.133 105 which becomes non negligible
at N = 255 with a 33% contribution to the time. This contribution of the inter-processor communication to the time can be also
observed on the time Tev al which increases with the number of processors in Table 1.
6. Application to DEMO design optimization with URANIE
SYCOMORE
An example of a DEMO design optimization is given in this
section to illustrate the performance of this coupling framework.
The aim of the optimization is to find the smallest reactor which
produces at least a net electric power of 500 MW. A pulsed reactor
(finite duty cycle) is studied in the present optimization problem. A
Fig. 7. Scalability graph for different numbers of parallel sessions. The study has
been achieved with a sampling of 10 000 SYCOMORE evaluations.
83
Table 2
Minimal and maximal values for the five input variables of the study. Mean interval between two consecutive points for
a random sampling of 106 points is given too.
Input variable
Symbol
Minimal value
Maximal value
Mean interval
Major radius
Minor radius
Toroidal field amplitude
Safety factor
Density-averaged electron temperature
R (m)
a (m)
Bt (T)
q95
Te ne (keV)
7.0
2.0
4.0
3.0
8
15.0
6.0
8.0
10.0
20
0.32
0.16
0.16
0.28
0.48
14
15
14.5
13
14
13.5
4.5
12
13
R [m]
R [m]
11
12
11.5
11
10
8.851
10.5
10
3.5
9.5
2.5
9
8.5
6
-500
8
7.5
7
a [m]
12.5
2.5
3.5
4.5
5.5
a [m]
Fig. 8. Feasibility domain (red points) delimited by a red line and points complying
with the constraints for the optimization (black points). The area of the expected
optimum is shown by an ellipse. The minor radius a is on the horizontal axis and
the major radius R is on the vertical one. (For interpretation of the references to
color in this figure legend, the reader is referred to the web version of this article.)
500
1000
Net Electric Power [MW]
1500
2000
Fig. 9. Pareto frontier for the two criteria optimization which involves minimizing
the major radius and maximizing the net electric power. The color scale represented
the minor radius. (For interpretation of the references to color in this figure legend,
the reader is referred to the web version of this article.)
84
Table 3
Single criterion optimization: Characteristic of the optimal population and comparison with the sampling prediction associated with confidence intervals.
Variable
Symbol
Optimum
Mean
Min
Max
Major radius
Minor radius
Toroidal field amplitude
Safety factor
Density-averaged electron temperature
Net electric power
Pulse duration
R (m)
a (m)
Bt (T)
q95
Te ne (keV)
Pnet (MW)
(s)
8.913
2.491
5.812
3.064
11.67
501.8
7235
8.929
2.497
5.810
3.068
11.66
504.0
7322
8.913
2.450
5.688
3.028
11.52
500.0
7200
8.933
2.522
5.953
3.099
11.97
516.3
7769
9.085 0.50
2.172 0.25
6.826 0.25
3.009 0.44
11.77 0.75
531.1
8510
Table 4
Values of the closest point to 500 MW in the two criteria optimization and comparison with the solution of one criterion
optimization.
Variable
Symbol
Simple optimization
2-criteria optimization
Major radius
Minor radius
Toroidal field amplitude
Safety factor
Density-averaged electron temperature
Net electric power
Pulse duration
R (m)
a (m)
Bt (T)
q95
Te ne (keV)
Pnet (MW)
(s)
8.913
2.491
5.812
3.064
11.67
501.8
7235
8.851
2.284
6.285
3.000
11.70
504.1
7286
Variable values of the closest point to 500 MW are listed in Table 4. Further characteristics of DEMO performances corresponding to that point are given in Appendix B. These values are similar to
the optimum found by the single criterion optimization except for
the Bt variable with a difference of about 8%. This difference suggests a weak dependency of the optimum on the toroidal magnetic
field. This observation has to be confirmed by a sensitivity study of
SYCOMORE on the toroidal magnetic field variation.
7. Conclusion
Acknowledgments
1 See http://www.euro-fusionscipub.org/eu-im.
85
Table B.5
DEMO characteristics for the optimum obtained with the mono-criteria optimization (Section 6.2) and for the optimum at 500 MW
obtained with the 2 criteria optimization (Section 6.3).
Variable
Symbol
Simple optimization
2-criteria optimization
Major radius
Minor radius
Toroidal field amplitude
Safety factor
Density-averaged electron temperature
Net electric power
Pulse duration
Total plasma current
Boostrap fraction
NBI-drived current
Confinement time
Thermal energy content
Normalized total beta value
Z-effective
Helium concentration
Argon concentration
Volume-averaged electron density
Volume-averaged electron temperature
Electron density (maximum, pedestal, edge)
Electron temperature (maximum, pedestal, edge)
Fusion power
Bremsstrahlung power loss
Syncrotron power loss
Line radiation power loss
Power through the separatrix
Neutral Beam Injection power
Fusion power gain
R (m)
a (m)
Bt (T)
q95
Te ne (keV)
Pnet (MW)
(s)
Ip (MA)
8.913
2.491
5.812
3.064
11.67
501.8
7235
14.25
30%
70%
3.20
756.3
2.49
1.49
5.5%
0.12%
8.22 1019
10.67
9.79, 7.53, 3.6 1019
25.7, 2.34, 0.1
1366
31
17
20
113
25
52.73
8.851
2.284
6.285
3.000
11.70
504.1
7286
13.18
31%
69%
2.97
696.4
2.50
1.48
5.6%
0.12%
9.02 1019
10.70
10.8, 8.29, 3.6 1019
25.2, 2.75, 0.1
1365
32
17
20
232
25
52.78
E (s)
(MJ)
N
Zeff
ne (m3 )
Te (keV)
ne,max,ped,edg (m3 )
Te,max,ped,edg (keV)
Pfus (MW)
Pbrem (MW)
Psynch (MW)
Pline (MW)
Pcon (MW)
PNBI (MW)
Q
(A.1)
(A.2)
86
[7] W.R. Elwasif, D.E. Bernholdt, S. Pannala, S. Allu, S.S. Foley, Parameter sweep
and optimization of loosely coupled simulations using the DAKOTA toolkit,
in: Proceedings of the 2012 IEEE 15th International Conference on Computational Science and Engineering, CSE12, IEEE Computer Society, Washington,
DC, USA, 2012, pp. 102110. http://dx.doi.org/10.1109/ICCSE.2012.24.
[8] C. Reux, L.D. Gallo, F. Imbeaux, J.-F. Artaud, P. Bernardi, J. Bucalossi, G.
Ciraolo, J.-L. Duchateau, C. Fausser, D. Galassi, P. Hertout, J.-C. Jaboulay, A. LiPuma, B. Saoutic, L. Zani, I. Contributors, DEMO reactor design using the new
modular system code SYCOMORE, Nucl. Fusion 55 (7) (2015) 073011. URL
http://stacks.iop.org/0029-5515/55/i=7/a=073011.
[9] F. Imbeaux, J. Lister, G. Huysmans, W. Zwingmann, M. Airaj, L. Appel, V. Basiuk,
D. Coster, L.-G. Eriksson, B. Guillerminet, D. Kalupin, C. Konz, G. Manduchi, M.
Ottaviani, G. Pereverzev, Y. Peysson, O. Sauter, J. Signoret, P. Strand, A generic
data structure for integrated modelling of tokamak physics and subsystems,
Comput. Phys. Comm. 181 (6) (2010) 987998.
http://dx.doi.org/10.1016/j.cpc.2010.02.001.
URL http://www.sciencedirect.com/science/article/pii/S0010465510000214.
[10] G. Falchetto, D. Coster, R. Coelho, B. Scott, L. Figini, D. Kalupin, E. Nardon, S.
Nowak, L. Alves, J. Artaud, V. Basiuk, J.P. Bizarro, C. Boulbe, A. Dinklage, D.
Farina, B. Faugeras, J. Ferreira, A. Figueiredo, P. Huynh, F. Imbeaux, I. IvanovaStanik, T. Jonsson, H.-J. Klingshirn, C. Konz, A. Kus, N. Marushchenko, G.
Pereverzev, M. Owsiak, E. Poli, Y. Peysson, R. Reimer, J. Signoret, O. Sauter, R.
Stankiewicz, P. Strand, I. Voitsekhovitch, E. Westerhof, T. Zok, W. Zwingmann,
I. Contributors, J. Contributors, the ASDEX Upgrade Team, The European
integrated tokamak modelling (ITM) effort: achievements and first physics
results, Nucl. Fusion 54 (4) (2014) 043018. URL http://stacks.iop.org/00295515/54/i=4/a=043018.
[11] Z. Dragojlovic, A.R. Raffray, F. Najmabadi, C. Kessel, L. Waganer, L. ElGuebaly, L. Bromberg, An advanced computational algorithm for systems
analysis of tokamak power plants, Fusion Eng. Des. 85 (2) (2010) 243265.
http://dx.doi.org/10.1016/j.fusengdes.2010.02.015.
URL http://www.sciencedirect.com/science/article/pii/S0920379610000414.
[12] M. Nakamura, R. Kemp, H. Utoh, D.J. Ward, K. Tobita, R. Hiwatari, G.
Federici, Efforts towards improvement of systems codes for the broader
approach DEMO design, Fusion Eng. Des. 87 (56) (2012) 864867.
tenth International Symposium on Fusion Nuclear Technology (ISFNT-10).
http://dx.doi.org/10.1016/j.fusengdes.2012.02.034.
URL http://www.sciencedirect.com/science/article/pii/S0920379612000944.
[13] M. Kovari, R. Kemp, H. Lux, P. Knight, J. Morris, D. Ward, Process: A systems
code for fusion power plants - part 1: Physics, Fusion Eng. Des. 89 (12) (2014)
30543069. http://dx.doi.org/10.1016/j.fusengdes.2014.09.018.
URL http://www.sciencedirect.com/science/article/pii/S0920379614005961.
[14] R. Brun, F. Rademakers, ROOTan object oriented data analysis framework,
Nucl. Instrum. Methods Phys. Res. A 389 (12) (1997) 8186. new Computing Techniques in Physics Research V. http://dx.doi.org/10.1016/S01689002(97)00048-X.
URL http://www.sciencedirect.com/science/article/pii/S016890029700048X.
[15] G. Arnaud, Manuel dutilisation de vizir distribu v2.0, CEA report
DEN/SFME/LGLS/RT/10-001/A (October 2009).