-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CMake and CUDA compiler warnings #3859
Conversation
Fixes the following compiler warning: ``` /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' output may be truncated copying 64 bytes from a string of length 255 [-Werror=stringop-truncation] ``` The hard-coded value of 64 should probably be MPI_MAX_PROCESSOR_NAME, but we cannot import mpi.h in CUDA code.
mmm-common.hpp is no longer included in mmm-common_cuda.hpp. The common parts (globals and prototypes) were moved to a new file mmm-base.hpp. This fixes the following compiler warning: ``` Building NVCC (Device) object src/core/CMakeFiles/EspressoCore.dir/actor/EspressoCore_generated_Mmm1dgpuForce_cuda.cu.o src/utils/include/utils/Span.hpp(88): warning: calling a __host__ function from a __host__ __device__ function is not allowed detected during instantiation of "Utils::Span<T>::Span(const C &) [with T=const double, C=std::vector<double, std::allocator<double>>, <unnamed>=std::vector<double, std::allocator<double>>, <unnamed>=std::vector<double, std::allocator<double>>]" /home/espresso/espresso/src/core/electrostatics_magnetostatics/mmm-common.hpp(49): here ```
It is mandatory to provide a directory when listing CMake variables with `cmake -L`, otherwise the command may fail. Since CMake 3.13.4, running this command without a directory generates a warning. See https://gitlab.kitware.com/cmake/cmake/-/issues/18838
Why did you rename |
I did not touch |
Ah sorry, I meant the header of course. |
Do you have any suggestion? The file contains so little it's hard to come up with a good name. Maybe |
Also shouldn't the exported variables and functions be in a cpp file with the same name as the header? |
I have a feeling that the stuff in |
Ceterum censeo... :-) |
Yes.
I would prefer not to duplicate any more code. I only realized today that I'll try to limit changes to |
Well not a hill I'm willing to die on, but for the record I do think that duplication is the best solution given the circumstance. |
Otherwise this looks good to me, except for the inline comments. |
This refactoring is planned, see jngrad/espresso:specfunc-refactor. The goal of this PR is to fix compiler warnings. |
Description of changes: - fix several issues in the CMake logic - fix GCC compiler warning `-Werror=stringop-truncation` in GPU code - document the CPU and GPU implementations of `specfunc`
Description of changes: - fix several issues in the CMake logic - fix GCC compiler warning `-Werror=stringop-truncation` in GPU code - document the CPU and GPU implementations of `specfunc`
Description of changes:
specfunc