@@ -86,15 +86,14 @@ def get_coverage_dir(self) -> Path:
86
86
"""Get absolute path for code coverage analysis."""
87
87
return (internal .CODECOV_DIR / f"R{ self .model_id } " ).absolute ()
88
88
89
- def _get_build_flags (self , mpi : bool , coverage : bool , compiler_id : str ) -> dict :
89
+ def _get_build_flags (self , coverage : bool , compiler_id : str ) -> dict :
90
90
"""Get flags for CMake build."""
91
91
# Supported compilers for code coverage
92
92
codecov_compilers = ["ifort" , "ifx" ]
93
93
94
94
build_flags = {}
95
95
96
96
build_flags ["build_type" ] = "Debug" if coverage else "Release"
97
- build_flags ["mpi" ] = "ON" if mpi else "OFF"
98
97
99
98
build_flags ["flags_init" ] = ""
100
99
@@ -164,14 +163,13 @@ def build(self, modules: list[str], mpi: bool, coverage: bool):
164
163
self .logger .debug (
165
164
f"Getting environment variable for compiler $FC = { env_fc } "
166
165
)
167
- build_flags = self ._get_build_flags (mpi , coverage , env_fc )
166
+ build_flags = self ._get_build_flags (coverage , env_fc )
168
167
env_fc = None
169
168
170
169
with chdir (path_to_repo ):
171
170
env = os .environ .copy ()
172
171
173
172
cmake_args = [
174
- f"-DCABLE_MPI={ build_flags ['mpi' ]} " ,
175
173
f"-DCMAKE_BUILD_TYPE={ build_flags ['build_type' ]} " ,
176
174
f"-DCMAKE_Fortran_FLAGS_INIT={ build_flags ['flags_init' ]} " ,
177
175
"-DCMAKE_VERBOSE_MAKEFILE=ON" ,
@@ -207,12 +205,20 @@ def build(self, modules: list[str], mpi: bool, coverage: bool):
207
205
)
208
206
209
207
self .subprocess_handler .run_cmd (
210
- "cmake -S . -B build " + " " .join (cmake_args ), env = env
208
+ "cmake -S . -B build/serial -DCABLE_MPI=OFF " + " " .join (cmake_args ), env = env
211
209
)
212
- self .subprocess_handler .run_cmd ("cmake --build build " , env = env )
210
+ self .subprocess_handler .run_cmd ("cmake --build build/serial " , env = env )
213
211
self .subprocess_handler .run_cmd (
214
- "cmake --install build --prefix ." , env = env
212
+ "cmake --install build/serial --prefix ." , env = env
215
213
)
214
+ if mpi :
215
+ self .subprocess_handler .run_cmd (
216
+ "cmake -S . -B build/mpi -DCABLE_MPI=ON " + " " .join (cmake_args ), env = env
217
+ )
218
+ self .subprocess_handler .run_cmd ("cmake --build build/mpi" , env = env )
219
+ self .subprocess_handler .run_cmd (
220
+ "cmake --install build/mpi --prefix ." , env = env
221
+ )
216
222
217
223
218
224
def remove_module_lines (file_path : Path ) -> None :
0 commit comments