# V0.15.0: intel + OPENMP compilation reports null pointer in random\_ray

**URL:** <https://openmc.discourse.group/t/v0-15-0-intel-openmp-compilation-reports-null-pointer-in-random-ray/4781>\
**Category:** User Support\
**Created:** [September 10, 2024, 2:38pm UTC](https://openmc.discourse.group/t/v0-15-0-intel-openmp-compilation-reports-null-pointer-in-random-ray/4781 "2024-09-10T14:38:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonTravleev](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AntonTravleev](https://openmc.discourse.group/u/AntonTravleev)\
**Post date:** [September 10, 2024, 2:38pm UTC](https://openmc.discourse.group/t/v0-15-0-intel-openmp-compilation-reports-null-pointer-in-random-ray/4781/1 "2024-09-10T14:38:40Z")

</div>

Hi,

I have problems with compiling version v0.15.0 and above (the develop branch) with intel and OMP support. The following output relates to `v0.15.0-33-g57816e6b8`.

Compilation initiated with the commands

```auto
export CXX=/software/intel/oneapi/mpi/2021.1.1/bin/mpiicc 

cmake \
    -DOPENMC_USE_MPI=on \
    -DHDF5_PREFER_PARALLEL=on \
    -DCMAKE_INSTALL_PREFIX=$openmc_exe_path \
    -DCMAKE_BUILD_TYPE=Release \
    -DOPENMC_USE_OPENMP=on \
    src 
make -j 16 

```

stops with the following messages:

```auto
...
[70%] Building CXX object CMakeFiles/libopenmc.dir/src/secondary_kalbach.cpp.o
/home/tan/work/gh/openmc/src/random_ray/random_ray_simulation.cpp(341): internal error: null pointer
  }
  ^

compilation aborted for /home/tan/work/gh/openmc/src/random_ray/random_ray_simulation.cpp (code 4)
make[2]: *** [CMakeFiles/libopenmc.dir/build.make:706: CMakeFiles/libopenmc.dir/src/random_ray/random_ray_simulation.cpp.o] Error 4
make[2]: *** Waiting for unfinished jobs....
/home/tan/work/gh/openmc/src/random_ray/flat_source_domain.cpp(1039): internal error: null pointer
  }
  ^

compilation aborted for /home/tan/work/gh/openmc/src/random_ray/flat_source_domain.cpp (code 4)
make[2]: *** [CMakeFiles/libopenmc.dir/build.make:734: CMakeFiles/libopenmc.dir/src/random_ray/flat_source_domain.cpp.o] Error 4
make[1]: *** [CMakeFiles/Makefile2:296: CMakeFiles/libopenmc.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

```

When the `-DOPENMC_USE_OPENMP` is set to `off` or when the `#pragma omp ...` lines in the above mentioned source code files are commented out, compilation succeeds.

For reference, this is the output of the command `cmake ...`:

```auto
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is Intel 2021.6.0.20220226
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /cluster/sys/home/software/intel/oneapi/mpi/2021.1.1/bin/mpiicc - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -qopenmp (found version "5.0")
-- Found OpenMP: TRUE (found version "4.5")
-- Found MPI_C: /cluster/sys/home/software/intel/oneapi/mpi/2021.1.1/lib/release/libmpi.so (found version "3.1")
-- Found MPI_CXX: /cluster/sys/home/software/intel/oneapi/mpi/2021.1.1/bin/mpiicc (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.34")
-- Found HDF5: /cluster/software/openMC/tst/hdf5/hdf5-1.12.3/mpi __2021.1.1____ compiler__2022.1.0/lib/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so (found version "1.12.3
-- HDF5 Libraries: /cluster/software/openMC/tst/hdf5/hdf5-1.12.3/mpi __2021.1.1____ compiler__2022.1.0/lib/libhdf5.so;/usr/lib64/libz.so
-- Using parallel HDF5
-- OpenMC C++ flags: -DH5Oget_info_by_idx_vers=1;-DH5O_info_t_vers=1
-- OpenMC Linker flags:
-- Found Git: /usr/bin/git (found version "2.27.0")
-- Submodule update
-- Did not find pugixml, will use submodule instead
-- Did not find fmt, will use submodule instead
-- Module support is disabled.
-- Version: 8.0.1
-- Build type: Release
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - not found
-- Did not find xtensor, will use submodule instead
-- xtl v0.7.7
-- Building xtensor v0.25.0
-- Found xtl v0.7.7
-- Did not find gsl-lite, will use submodule instead
-- Project 'gsl_lite', package 'gsl-lite' version: '0.36.1'
-- Did not find Catch2, will use submodule instead
-- Configuring done
-- Generating done

```

Compilation with a gcc compiler completes sucessfully, however. The correspondent cmake output is here:

```auto
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/software/gcc-11.2.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/software/openmpi-4.1.2-gcc-11.2/bin/mpicxx - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found MPI_C: /cluster/sys/home/software/openmpi-4.1.2-gcc-11.2/lib/libmpi.so (found version "3.1")
-- Found MPI_CXX: /home/software/openmpi-4.1.2-gcc-11.2/bin/mpicxx (found version "3.1")
-- Found MPI: TRUE (found version "3.1")
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.34")
-- Found HDF5: /cluster/software/openMC/tst/hdf5/hdf5-1.12.3/mpi __ompi-4.1.2-gcc11.2-ucx____ compiler __gcc__ gcc-11.2.0/lib/libhdf5.so;/usr/lib64/libz.so;/usr/lib64/libdl.so;/usr/lib64/libm.so (
-- HDF5 Libraries: /cluster/software/openMC/tst/hdf5/hdf5-1.12.3/mpi __ompi-4.1.2-gcc11.2-ucx____ compiler __gcc__ gcc-11.2.0/lib/libhdf5.so;/usr/lib64/libz.so
-- Using parallel HDF5
-- OpenMC C++ flags: -DH5Oget_info_by_idx_vers=1;-DH5O_info_t_vers=1
-- OpenMC Linker flags:
-- Found Git: /usr/bin/git (found version "2.27.0")
-- Submodule update
-- Did not find pugixml, will use submodule instead
-- Did not find fmt, will use submodule instead
-- Module support is disabled.
-- Version: 8.0.1
-- Build type: Release
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - not found
-- Did not find xtensor, will use submodule instead
-- xtl v0.7.7
-- Building xtensor v0.25.0
-- Found xtl v0.7.7
-- Did not find gsl-lite, will use submodule instead
-- Project 'gsl_lite', package 'gsl-lite' version: '0.36.1'
-- Did not find Catch2, will use submodule instead
-- Performing Test HAVE_FLAG __ffile_prefix_map__ home_tan_work_gh_openmc_vendor_Catch2__
-- Performing Test HAVE_FLAG __ffile_prefix_map__ home_tan_work_gh_openmc_vendor_Catch2__ - Success
-- Configuring done
-- Generating done

```

Does anyone experience similar problems with intel and OMP?

with best regards, Anton.

---

<div class="post-metadata">

**Author:** ![jtramm](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/jtramm/32/1278_2.png) [@jtramm](https://openmc.discourse.group/u/jtramm)\
**Post date:** [September 16, 2024, 7:42pm UTC](https://openmc.discourse.group/t/v0-15-0-intel-openmp-compilation-reports-null-pointer-in-random-ray/4781/2 "2024-09-16T19:42:41Z")

</div>

OpenMC appears to be compiling and running cleanly for me with the 2024.1 release of the Intel OneAPI compiler and mpich 4.2.1.

I’m wondering if the linker is having issues as you’re passing the Intel MPI C wrapper instead of the C++ wrapper. I.e., you have:

`export CXX=/software/intel/oneapi/mpi/2021.1.1/bin/mpiicc`

but it’s possible you may need to do:

`export CXX=/software/intel/oneapi/mpi/2021.1.1/bin/mpiicpc`  
`export CC=/software/intel/oneapi/mpi/2021.1.1/bin/mpiicc`

It’s also possible that may not be the issue. From what I can tell, it looks like the error you’re seeing is a compiler bug (which is why it is reporting as “internal error”). As it appears to be fixed in more recent compiler versions, if specifying the CC/CXX doesn’t fix it, your best bet would appear to be updating to a newer version of OneAPI.

---

<div class="post-metadata">

**Author:** ![AntonTravleev](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AntonTravleev](https://openmc.discourse.group/u/AntonTravleev)\
**Post date:** [September 24, 2024, 2:41pm UTC](https://openmc.discourse.group/t/v0-15-0-intel-openmp-compilation-reports-null-pointer-in-random-ray/4781/3 "2024-09-24T14:41:48Z")

</div>

Hi Jtramm,

thank you for the response. Indeed, setting `CXX` and `CC` as you proposed helps cmake to find the Intel C compiler. However, even in this case I get the same internal error, so it seems your assumption about the compiler bug is the correct one.
