2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2015,2016, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
38 'mdrun-only': Option
.simple
,
39 'static': Option
.simple
,
40 'reference': Option
.simple
,
41 'release': Option
.simple
,
42 'release-with-debug-info': Option
.simple
,
43 'asan': Option
.simple
,
45 'fftpack': Option
.simple
,
46 'double': Option
.simple
,
47 'thread-mpi': Option
.bool,
51 extra_projects
= [Project
.REGRESSIONTESTS
]
53 def do_build(context
):
55 cmake_opts
['GMX_COMPILER_WARNINGS'] = 'ON'
56 cmake_opts
['GMX_DEFAULT_SUFFIX'] = 'OFF'
57 cmake_opts
['CMAKE_BUILD_TYPE'] = 'Debug'
59 if context
.opts
.reference
:
60 cmake_opts
['CMAKE_BUILD_TYPE'] = 'Reference'
61 elif context
.opts
.release
:
62 cmake_opts
['CMAKE_BUILD_TYPE'] = 'RelWithAssert'
63 elif context
.opts
['release-with-debug-info']:
64 cmake_opts
['CMAKE_BUILD_TYPE'] = 'RelWithDebInfo'
65 elif context
.opts
.asan
:
66 cmake_opts
['CMAKE_BUILD_TYPE'] = 'ASAN'
67 elif context
.opts
.tsan
:
68 cmake_opts
['CMAKE_BUILD_TYPE'] = 'TSAN'
70 if context
.opts
.static
:
71 cmake_opts
['BUILD_SHARED_LIBS'] = 'OFF'
74 cmake_opts
['CMAKE_TOOLCHAIN_FILE'] = 'Platform/XeonPhi'
76 if context
.opts
.double
:
77 cmake_opts
['GMX_DOUBLE'] = 'ON'
79 if context
.opts
.simd
is None:
80 cmake_opts
['GMX_SIMD'] = 'None'
82 cmake_opts
['GMX_SIMD'] = context
.opts
.simd
84 cmake_opts
['GMX_GPU'] = 'ON'
85 cmake_opts
.update(context
.get_cuda_cmake_options())
87 cmake_opts
['GMX_GPU'] = 'OFF'
88 if context
.opts
.thread_mpi
is False:
89 cmake_opts
['GMX_THREAD_MPI'] = 'OFF'
91 cmake_opts
['GMX_MPI'] = 'ON'
92 if context
.opts
.openmp
is False:
93 cmake_opts
['GMX_OPENMP'] = 'OFF'
96 cmake_opts
['GMX_FFT_LIBRARY'] = 'mkl'
97 elif context
.opts
.fftpack
:
98 cmake_opts
['GMX_FFT_LIBRARY'] = 'fftpack'
99 if context
.opts
.mkl
or context
.opts
.atlas
:
100 cmake_opts
['GMX_EXTERNAL_BLAS'] = 'ON'
101 cmake_opts
['GMX_EXTERNAL_LAPACK'] = 'ON'
104 cmake_opts
['GMX_X11'] = 'ON'
106 if context
.job_type
== JobType
.RELEASE
:
107 # TODO: Consider using REGRESSIONTEST_DOWNLOAD here, after refactoring
108 # it to make that possible. Or use some other mechanism to check the
109 # MD5 of the regressiontests tarball (also taking into account the -dev
110 # builds where the hardcoded value in gmxVersionInfo.cmake is not
112 cmake_opts
['REGRESSIONTEST_PATH'] = context
.workspace
.get_project_dir(Project
.REGRESSIONTESTS
)
114 if context
.opts
.mdrun_only
:
115 cmake_opts
['GMX_BUILD_MDRUN_ONLY'] = 'ON'
117 context
.env
.set_env_var('GMX_NO_TERM', '1')
119 context
.run_cmake(cmake_opts
)
120 context
.build_target(target
=None, keep_going
=True)
122 # TODO: Consider if it would be better to split this into a separate build
123 # script, since it is somewhat different, even though it benefits from some
124 # of the same build options.
125 if context
.job_type
== JobType
.RELEASE
:
126 context
.build_target(target
='check', keep_going
=True)
127 context
.build_target(target
='install')
128 if context
.opts
.mdrun_only
:
129 context
.workspace
.clean_build_dir()
130 cmake_opts
['REGRESSIONTEST_PATH'] = None
131 cmake_opts
['GMX_BUILD_MDRUN_ONLY'] = 'ON'
132 context
.run_cmake(cmake_opts
)
133 context
.build_target(target
=None, keep_going
=True)
134 context
.build_target(target
='check', keep_going
=True)
135 context
.build_target(target
='install')
136 # TODO: Run regression tests against the installed version.
137 # TODO: Add testing for building the template.
138 # TODO: Generalize the machinery here such that it can easily be used
139 # also for non-release builds.
141 context
.build_target(target
='tests', keep_going
=True)
143 context
.run_ctest(args
=['--output-on-failure'])
145 if not context
.opts
.mdrun_only
:
146 context
.env
.prepend_path_env(os
.path
.join(context
.workspace
.build_dir
, 'bin'))
147 context
.chdir(context
.workspace
.get_project_dir(Project
.REGRESSIONTESTS
))
149 if not context
.opts
.mpi
and context
.opts
.thread_mpi
is not False:
152 cmd
= 'perl gmxtest.pl -mpirun mpirun -xml -nosuffix all'
153 if context
.opts
.asan
:
154 cmd
+=' -parse asan_symbolize.py'
156 # setting this stuff below is just a temporary solution,
157 # it should all be passed as a proper the runconf from outside
158 # The whole mechanism should be rethought in #1587.
161 elif context
.opts
.openmp
:
162 # OpenMP should always work when compiled in! Currently not set if
167 if context
.opts
.mpi
or use_tmpi
:
168 gpu_id
= '01' # for (T)MPI use the two GT 640-s
170 gpu_id
= '0' # use GPU #0 by default
171 cmd
+= ' -gpu_id ' + gpu_id
173 # TODO: Add options to influence this (should be now local to the build
179 if context
.opts
.double
:
181 context
.run_cmd(cmd
, shell
=True, failure_message
='Regression tests failed to execute')