openmc-dev / openmc

OpenMC Monte Carlo Code
https://docs.openmc.org
Other
764 stars 492 forks source link

Building with OpenMP without defining CC #701

Closed wbinventor closed 8 years ago

wbinventor commented 8 years ago

I recently updated to the latest version of develop and ran into an issue building on INL's Falcon supercomputer. In particular, the issue only occurs when building with OpenMP. When I try to configure and build with the following commands:

> FC=mpif90 CC=mpicc HDF5_ROOT=/path/to/phdf5 cmake -Dopenmp=on ..
> make

I obtain the following error at link time:

[100%] Linking Fortran executable bin/openmc
CMakeFiles/openmc.dir/src/cmfd_input.F90.o: In function `__cmfd_input_MOD_read_cmfd_xml':
cmfd_input.F90:(.text+0x17da): undefined reference to `GOMP_parallel'
CMakeFiles/openmc.dir/src/eigenvalue.F90.o: In function `__eigenvalue_MOD_join_bank_from_threads':
eigenvalue.F90:(.text+0x269): undefined reference to `GOMP_parallel'
CMakeFiles/openmc.dir/src/global.F90.o: In function `__global_MOD_free_memory':
global.F90:(.text+0x118d): undefined reference to `GOMP_parallel'
CMakeFiles/openmc.dir/src/initialize.F90.o: In function `__initialize_MOD_allocate_banks':
initialize.F90:(.text+0x1e8f): undefined reference to `GOMP_parallel'
CMakeFiles/openmc.dir/src/input_xml.F90.o: In function `__input_xml_MOD_read_ce_cross_sections':
input_xml.F90:(.text+0x1eb5): undefined reference to `GOMP_parallel'
CMakeFiles/openmc.dir/src/mgxs_data.F90.o:mgxs_data.F90:(.text+0x5cd): more undefined references to `GOMP_parallel' follow
collect2: error: ld returned 1 exit status
make[2]: *** [bin/openmc] Error 1
make[1]: *** [CMakeFiles/openmc.dir/all] Error 2
make: *** [all] Error 2

After some trial and error I discovered that if I prepend CC=mpicc to the CMake command then the code compiles and links just fine. Has anyone else run into this? Is this an issue, or something that needs to be added to the documentation? I've not followed some of the major recent PRs (multipole, openmc.data) so I don't know what changed in the last two months to necessitate the use of CC when building OpenMC.

cjosey commented 8 years ago

The Faddeeva function used for multipole is written in C, which is likely the reason.

wbinventor commented 8 years ago

Yeah, I thought that might be the case since I ran into some other issues when trying to use different compilers.

paulromano commented 8 years ago

Good point, we need to update the documentation for this.