wildmeshing / fTetWild

Fast Tetrahedral Meshing in the Wild
https://yixin-hu.github.io/ftetwild.pdf
Mozilla Public License 2.0
381 stars 77 forks source link

fTetWild with kokkos #28

Closed hph73 closed 3 years ago

hph73 commented 3 years ago

Hi,

I am trying to use both fTetWild and kokkos (developed by Sandia National Lab for parallel computing https://github.com/kokkos/kokkos ) in my project. I build the project with mpic++ and set OMPI_CXX to the nvcc_wrapper provided by kokkos and link fTetWild as a static library. The build process works fine but I get segmentation fault error when I run the code.

I have prepared the testing codes in this depository https://github.com/hph73/tetraWild-Kokkos. A makefile has been attached in src. Here are a few additional steps you may need before you can test.

  1. Download kokkos from https://github.com/kokkos/kokkos
  2. Install OpenMPI https://www.open-mpi.org/
  3. Install cuda library
  4. Set environment variable export OMPI_CXX=<path_to_kokkos>/bin/nvcc_wrapper
  5. You may want to replace the static libraries in lib with the ones built from tetrawild on your PC.

When the code is built by setting CXX=g++, everything works fine. When the code is build by the kokkos nvcc wrapper (enabled by setting CXX=mpic++), the build process is successful but the code gets segmentation fault.

Thanks!

hph73 commented 3 years ago

The problem is possibly caused by OpenMP as discuss here https://github.com/oneapi-src/oneDNN/issues/463. OpenMP seems to not work very well with other kinds of threading.

Is it possible to set a flag to remove the dependency on OpenMP such as option(FLOAT_TETWILD_ENABLE_OpenMP "Enable OpenMP" OFF)

Thanks.

teseoch commented 3 years ago

I dont think fTetWild uses OpenMP, maybe one of its dependencies? We are using TBB for the parallelization

hph73 commented 3 years ago

I have solved this problem. To use fTetraWild with Kokkos, we need to compile fTetraWild with nvcc wrapper provided by Kokkos. Also, use gcc newer than version 9.2 to avoid compilation errors.