amrex
amrex copied to clipboard
Windows Symbol: amrex::Gpu::Device::max_gpu_streams
In https://github.com/ECP-WarpX/impactx/pull/205, I investigate a symbol error from AMReX of the form: Clang-Cl:
lld-link: error: undefined symbol: private: static int amrex::Gpu::Device::max_gpu_streams
>>> referenced by _deps\fetchedablastr-build\CMakeFiles\ablastr.dir\Source\ablastr\utils\Communication.cpp.obj:(.omp_outlined.)
>>> referenced by _deps\fetchedablastr-build\CMakeFiles\ablastr.dir\Source\ablastr\utils\Communication.cpp.obj:(.omp_outlined..5)
MSVC:
"D:\a\impactx\impactx\build\_deps\fetchedablastr-build\ablastr.vcxproj" (default target) (6) ->
(Link target) ->
Communication.obj : error LNK2001: unresolved external symbol "private: static int amrex::Gpu::Device::max_gpu_streams" (?max_gpu_streams@Device@Gpu@amrex@@0HA) [D:\a\impactx\impactx\build\_deps\fetchedablastr-build\ablastr.vcxproj]
D:\a\impactx\impactx\build\bin\Debug\ablastr.dll : fatal error LNK1120: 1 unresolved externals [D:\a\impactx\impactx\build\_deps\fetchedablastr-build\ablastr.vcxproj]
We build AMReX as shared lib that goes into a further shared lib in WarpX (ABLASTR) that then gets consumed by the ImpactX executable. Builds are with CMake (as in WarpX).
static for functions means it's only visible in the current TU, maybe we should remove the static?
https://github.com/AMReX-Codes/amrex/blob/4f639294606d47185d31eaee4af66fc6b590e5a2/Src/Base/AMReX_GpuDevice.H#L66
Ah no, it's a global - this one need export: https://github.com/AMReX-Codes/amrex/blob/4f639294606d47185d31eaee4af66fc6b590e5a2/Src/Base/AMReX_GpuDevice.H#L172