Skip to content

Commit

Permalink
Merge pull request #1935 from su2code/feature_update_mpp
Browse files Browse the repository at this point in the history
Compile SU2 with Mutation++ for regression tests
  • Loading branch information
pcarruscag authored Aug 20, 2023
2 parents da0c951 + 68cdd8d commit b7c1577
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 32 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
config_set: [BaseMPI, ReverseMPI, ForwardMPI, BaseNoMPI, ReverseNoMPI, ForwardNoMPI, BaseOMP, ReverseOMP, ForwardOMP]
include:
- config_set: BaseMPI
flags: '-Denable-pywrapper=true -Denable-coolprop=true -Denable-mlpcpp=true -Denable-tests=true --warnlevel=2 --werror'
flags: '-Denable-pywrapper=true -Denable-coolprop=true -Denable-mpp=true -Dinstall-mpp=true -Denable-mlpcpp=true -Denable-tests=true --warnlevel=2'
- config_set: ReverseMPI
flags: '-Denable-autodiff=true -Denable-normal=false -Denable-pywrapper=true -Denable-tests=true --warnlevel=3 --werror'
- config_set: ForwardMPI
Expand All @@ -52,23 +52,23 @@ jobs:
key: ${{ matrix.config_set }}-${{ github.sha }}
restore-keys: ${{ matrix.config_set }}
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
- name: Build
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2:230813-0103
with:
args: -b ${{github.ref}} -f "${{matrix.flags}}"
- name: Compress binaries
run: tar -zcvf install_bin.tgz install/bin
run: tar -zcvf install_bin.tgz install/*
- name: Upload Binaries
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config_set }}
path: install_bin.tgz
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -95,23 +95,23 @@ jobs:
key: ${{ matrix.config_set }}-${{ github.sha }}
restore-keys: ${{ matrix.config_set }}
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
- name: Build
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230813-0103
with:
args: -b ${{github.ref}} -f "${{matrix.flags}}"
- name: Compress binaries
run: tar -zcvf install_bin.tgz install/bin
run: tar -zcvf install_bin.tgz install/*
- name: Upload Binaries
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config_set }}
path: install_bin.tgz
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
tag: OMP
steps:
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -161,19 +161,19 @@ jobs:
ls -lah
tar -zxvf install_bin.tgz
ls -lah install/bin/
cp -r install/bin/* $BIN_FOLDER;
cp -r install/* $BIN_FOLDER/../
popd;
fi
done
chmod a+x $BIN_FOLDER/*
ls -lahR $BIN_FOLDER
- name: Run Tests in Container
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -188,7 +188,7 @@ jobs:
testscript: ['hybrid_regression.py', 'hybrid_regression_AD.py']
steps:
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -207,19 +207,19 @@ jobs:
ls -lah
tar -zxvf install_bin.tgz
ls -lah install/bin/
cp -r install/bin/* $BIN_FOLDER;
cp -r install/* $BIN_FOLDER/../
popd;
fi
done
chmod a+x $BIN_FOLDER/*
ls -lahR $BIN_FOLDER
- name: Run Tests in Container
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230813-0103
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} -a "--tsan"
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand All @@ -240,7 +240,7 @@ jobs:
tag: MPI
steps:
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
Expand Down Expand Up @@ -273,7 +273,7 @@ jobs:
ls -lah
tar -zxvf install_bin.tgz
ls -laH install/bin/
cp -r install/bin/* $BIN_FOLDER;
cp -r install/* $BIN_FOLDER/../
popd;
else
echo "$TYPE_FOLDER does not exist!"
Expand Down Expand Up @@ -301,11 +301,11 @@ jobs:
echo $PWD
ls -lahR
- name: Run Unit Tests
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
with:
entrypoint: install/bin/${{matrix.testdriver}}
- name: Post Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:230704-1323
uses: docker://ghcr.io/su2code/su2/test-su2:230813-0103
with:
entrypoint: /bin/rm
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
2 changes: 1 addition & 1 deletion .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
key: ${{ matrix.os_bin }}-${{ github.sha }}
restore-keys: ${{ matrix.os_bin }}
- name: Build
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230704-1323
uses: docker://ghcr.io/su2code/su2/build-su2-cross:230813-0103
with:
args: -b ${{ github.sha }} -f "${{matrix.flags}}"
- name: Create Archive
Expand Down
5 changes: 2 additions & 3 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3983,9 +3983,8 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
}
}

if (Kind_FluidModel == MUTATIONPP &&
(Kind_TransCoeffModel != TRANSCOEFFMODEL::WILKE && Kind_TransCoeffModel != TRANSCOEFFMODEL::CHAPMANN_ENSKOG)) {
SU2_MPI::Error("Transport model not available for NEMO solver using MUTATIONPP. Please use the WILKE or CHAPMANN_ENSKOG transport model instead..",
if (Kind_FluidModel == MUTATIONPP && (Kind_TransCoeffModel == TRANSCOEFFMODEL::SUTHERLAND)) {
SU2_MPI::Error("Transport model not available for NEMO solver using MUTATIONPP. Please use the WILKE, GUPTAYOS, or CHAPMANN_ENSKOG transport model instead.",
CURRENT_FUNCTION);
}

Expand Down
11 changes: 11 additions & 0 deletions SU2_PY/copy_directory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python
# Copyright 2012-2023, SU2 Contributors (cf. AUTHORS.md)

import sys
import os
import shutil

if __name__ == "__main__":
src = os.path.abspath(sys.argv[1])
dst = os.path.abspath(sys.argv[2])
shutil.copytree(src, dst)
40 changes: 33 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,28 @@ endforeach
catch2_dep = declare_dependency(include_directories: 'externals/catch2/')

if get_option('enable-mpp')
cmake = import('cmake')
mpp_subproj = cmake.subproject('Mutationpp')
if build_machine.cpu_family() == 'x86' or build_machine.cpu_family() == 'x86_64'
cmake = import('cmake')
cmake_opts = cmake.subproject_options()
cmake_opts.set_override_option('warning_level', '0')
cmake_opts.add_cmake_defines({
'CMAKE_MAKE_PROGRAM': join_paths(meson.project_source_root(), 'ninja'),
'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'
})
cmake_opts.set_install(get_option('install-mpp'))
endif
mpp_subproj = cmake.subproject('Mutationpp', options: cmake_opts)
mpp_dep = mpp_subproj.dependency('mutation++')
su2_deps += mpp_dep
su2_cpp_args += '-DHAVE_MPP'

if get_option('install-mpp')
py = find_program('python3', 'python')
p = run_command(py, 'SU2_PY/copy_directory.py', 'subprojects/Mutationpp/data', join_paths(get_option('prefix'), 'mpp-data'))
if p.returncode() != 0
error(p.stderr())
endif
endif
endif

if get_option('enable-coolprop')
Expand All @@ -259,7 +276,7 @@ if get_option('enable-coolprop')
cmake_opts.set_override_option('warning_level', '0')
cmake_opts.add_cmake_defines({
'COOLPROP_STATIC_LIBRARY': true,
'CMAKE_MAKE_PROGRAM': meson.source_root() + '/ninja',
'CMAKE_MAKE_PROGRAM': join_paths(meson.project_source_root(), 'ninja'),
'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'
})
coolprop_subproj = cmake.subproject('CoolProp', options: cmake_opts)
Expand Down Expand Up @@ -344,12 +361,21 @@ message('''---------------------------------------------------------------------
get_option('enable-mlpcpp'), meson.project_build_root().startswith(meson.project_source_root()) ? meson.project_build_root().split('/')[-1] : meson.project_build_root()))

if get_option('enable-mpp')
message(''' To run SU2 with Mutation++ library, add these lines to your .bashrc file:
if get_option('install-mpp')
message(''' To run SU2 with Mutation++ library, add these lines to your .bashrc file:
export MPP_DATA_DIRECTORY=$SU2_HOME/subprojects/Mutationpp/data
export LD_LIBRARY_PATH=$SU2_HOME/<build_dir>/subprojects/Mutationpp
export MPP_DATA_DIRECTORY=$SU2_RUN/../mpp-data
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SU2_RUN/../lib
''')
''')
else
message(''' To run SU2 with Mutation++ library, add these lines to your .bashrc file:
export MPP_DATA_DIRECTORY=$SU2_HOME/subprojects/Mutationpp/data
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SU2_HOME/<build_dir>/subprojects/Mutationpp
''')
endif
endif

if get_option('enable-librom')
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ option('enable-tests', type : 'boolean', value : false, description: 'compile U
option('enable-mixedprec', type : 'boolean', value : false, description: 'use single precision floating point arithmetic for sparse algebra')
option('extra-deps', type : 'string', value : '', description: 'comma-separated list of extra (custom) dependencies to add for compilation')
option('enable-mpp', type : 'boolean', value : false, description: 'enable Mutation++ support')
option('install-mpp', type : 'boolean', value : false, description: 'install Mutation++ in the directory defined with --prefix')
option('enable-coolprop', type : 'boolean', value : false, description: 'enable CoolProp support')
option('enable-mlpcpp', type : 'boolean', value : false, description: 'enable MLPCpp support')
option('opdi-backend', type : 'combo', choices : ['auto', 'macro', 'ompt'], value : 'auto', description: 'OpDiLib backend choice')
Expand Down

0 comments on commit b7c1577

Please sign in to comment.