Xiangyu-Hu / SPHinXsys

SPHinXsys provides C++ APIs for engineering simulation and optimization. It aims at complex systems driven by fluid, structure, multi-body dynamics and beyond. The multi-physics library is based on a unique and unified computational framework by which strong coupling has been achieved for all involved physics.
https://www.sphinxsys.org/
Apache License 2.0
259 stars 199 forks source link

Feature/cmake rework #166

Closed FabienPean-Virtonomy closed 1 year ago

FabienPean-Virtonomy commented 1 year ago
DrChiZhang commented 1 year ago

Looks like finding boost when BOOST_HOME only defined as environment variable not work, any fix?

FabienPean-Virtonomy commented 1 year ago

One should set BOOST_ROOT instead, which is the correct way to hint a path, more so when the FindBoost exists as part of CMake

DrChiZhang commented 1 year ago

Looks like the cxx_std_17 feature does not work for my scientific linux 7.9 system, reporting the error of "filesystem: No such file or directory" target_compile_features(sphinxsys_core INTERFACE cxx_std_17 ), any idea?

FabienPean-Virtonomy commented 1 year ago

That's not a CMake problem otherwise you would fail to configure due to minimum version required being 3.16.

I hadn't heard of anyone using Scientific Linux before, based on a brief search it seems to use ultra-conservative versions of packages. The filesystem library in GCC was introduced in the v8 release (May 2, 2018). What is the version of your GCC compiler ?

DrChiZhang commented 1 year ago

Hi gcc9 is used as gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

DrChiZhang commented 1 year ago

Lots of compiling issues reported from my side. As your present cmake version is based on the package-manager-installed dependencies, I would like to strongly suggest revering to the original version, and try another merge with master after comprehensive tests on both windows and user-installed dependencies.

FabienPean-Virtonomy commented 1 year ago

Ok so it is more complicated than that sadly. I rebuilt from scratch (deleted build folder and rebuild) and didn't face this problem with GCC 9.4.0. The filesystem library is not experimental in v9 and does not require special linking flag anymore. If you already did a clean rebuild, please post the full log.

DrChiZhang commented 1 year ago

Cmake output:

-- The CXX compiler identification is GNU 9.3.1 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /opt/rh/devtoolset-9/root/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning (dev) at /work/czhang/MyPrefix/miniconda/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message): The package name passed to find_package_handle_standard_args (Simbody) does not match the name of the calling package (SIMBODY). This can lead to problems in calling code that expects find_package result variables (e.g., _FOUND) to follow a certain pattern. Call Stack (most recent call first): cmake/FindSIMBODY.cmake:189 (find_package_handle_standard_args) CMakeLists.txt:29 (find_package) This warning is for project developers. Use -Wno-dev to suppress it.

-- Found Simbody: /home/czhang/work/MyPrefix/simbody/include/simbody
-- Found TBB: /global/intel/v19.0/tbb/include
-- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found Boost: /home/czhang/work/prefix-boost-1-67/include (found version "1.67.0") found components: program_options filesystem system -- Found GTest: /home/czhang/work/MyPrefix/gtest/lib64/libgtest.a
-- The C compiler identification is GNU 9.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /opt/rh/devtoolset-9/root/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Found Python3: /home/czhang/work/MyPrefix/miniconda/bin/python3.8 (found version "3.8.13") found components: Interpreter Development Development.Module Development.Embed -- Configuring done -- Generating done -- Build files have been written to: /local/disk1/zhangchi/GitHub/SPHinXsys/build

With TBB error:

In file included from /global/intel/v19.0/tbb/include/tbb/tbb.h:77, from /local/disk1/zhangchi/GitHub/SPHinXsys/SPHINXsys/src/shared/common/large_data_containers.h:26, from /local/disk1/zhangchi/GitHub/SPHinXsys/SPHINXsys/src/shared/common/base_data_package.h:30, from /local/disk1/zhangchi/GitHub/SPHinXsys/SPHINXsys/src/shared/adaptations/adaptation.h:33, from /local/disk1/zhangchi/GitHub/SPHinXsys/SPHINXsys/src/shared/adaptations/adaptation.cpp:7: /global/intel/v19.0/tbb/include/tbb/task_group.h: In destructor ‘tbb::internal::task_group_base::~task_group_base()’: /global/intel/v19.0/tbb/include/tbb/task_group.h:131:53: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations] 131 | bool stack_unwinding_in_progress = std::uncaught_exception();

FabienPean-Virtonomy commented 1 year ago

Lots of compiling issues reported from my side. As your present cmake version is based on the package-manager-installed dependencies, I would like to strongly suggest revering to the original version, and try another merge with master after comprehensive tests on both windows and user-installed dependencies.

Yes, might be better that way, please report those errors on the future PR.

FabienPean-Virtonomy commented 1 year ago

In file included from /global/intel/v19.0/tbb/include/tbb/tbb.h:77,

The flag -Werror might be too much for this old version of TBB. Is supporting this version a requirement? Because TBB is easily installed on the user-space via Intel oneAPI or from source

DrChiZhang commented 1 year ago

Hi I also try intel oneAPI with tbb v22.1, another error reports, In file included from /home/czhang/work/MyCode/sphinxsys-beta-chi/SPHINXsys/src/shared/bodies/base_body.h:43, from /home/czhang/work/MyCode/sphinxsys-beta-chi/SPHINXsys/src/shared/adaptations/adaptation.cpp:11: /home/czhang/work/MyCode/sphinxsys-beta-chi/SPHINXsys/src/shared/particles/particle_sorting.h:47:15: error: ‘tbb::internal’ has not been declared 47 | using tbb::internal::no_assign;

any idea ?

FabienPean-Virtonomy commented 1 year ago

That's a problem from SPHinxsys with newer TBB. We normally fixed it on our side in #163 which is blocked for different reasons. This change is probably not backward compatible with your old version though.

DrChiZhang commented 1 year ago

I will have a look, thanks.

FabienPean-Virtonomy commented 1 year ago

I will look further into cleaning out the build system generation. I can't guarantee backward compatibility since the requirement on minimum dependency versions are unspecified. Although, I should be able to provide simple instructions for getting started using user-space dependencies. My goal is to have a codebase that does not leak compilation flags and follow the C++ standard strictly.

DrChiZhang commented 1 year ago

Concerning the TBB, we should go to the latest version, therefore, the corresponding modification in your size in #163 should be updated. Also, simple construction is essential, and we may have more tests on different system, please contact me if you need any help.