amrex icon indicating copy to clipboard operation
amrex copied to clipboard

Windows Symbol: amrex::Gpu::Device::max_gpu_streams

Open ax3l opened this issue 3 years ago • 2 comments

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).

ax3l avatar Aug 15 '22 02:08 ax3l

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

ax3l avatar Aug 15 '22 16:08 ax3l

Ah no, it's a global - this one need export: https://github.com/AMReX-Codes/amrex/blob/4f639294606d47185d31eaee4af66fc6b590e5a2/Src/Base/AMReX_GpuDevice.H#L172

ax3l avatar Aug 15 '22 16:08 ax3l