[petsc-dev] help on Summit

Junchao Zhang junchao.zhang at gmail.com
Mon Aug 30 13:44:39 CDT 2021


Can you use less fancy 'static const int'?
--Junchao Zhang


On Mon, Aug 30, 2021 at 1:02 PM Jacob Faibussowitsch <jacob.fai at gmail.com>
wrote:

> No luck with C++14
>
>
> TL;DR: you need to have host and device compiler either both using c++17
> or neither using c++17.
>
> Long version:
> C++17 among other things changed how static constexpr member variables for
> classes worked. Previously if I had a class with a static constexpr member
> variable I would have to not only declare it inline within the class, but
> also define it within an executable otherwise the variable would not
> actually have any physical memory address:
>
> // foo.hpp
> class foo
> {
>   static constexpr int bar = 5;
> };
>
> // foo.cpp
> int foo::bar;
>
> In c++17 however this changed because you can have static “inline”
> variables. All this does is force the compiler define the variable for you
> instead. The issue of course is that static constexpr implicitly makes that
> variable inline in c++17. So to sum it up:
>
> 1. The c++17 compiler (nvcc) sees the static constexpr variable, goes “hmm
> ok I will define this in some undefined location”.
> 2. The c++11/14 compiler comes along, sees your hand-coded definition of
> the variable and goes “ah but I think I’ve seen this before, I’ll ignore
> it”. This silent rejection is due to the hand-coded definition idiom being
> deprecated from c++17 onwards. Stupid, I know.
> 2. The linker (driven by the c++11/14 compiler since PETSc links using the
> host compiler) comes along and now suddenly cannot find the literal
> definition, because it doesn’t know what the c++17 did. Disaster!
>
> Best regards,
>
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
>
> On Aug 30, 2021, at 10:12, Mark Adams <mfadams at lbl.gov> wrote:
>
> No luck with C++14
>
>        CUDAC
> arch-summit-hypre-cuda-dbg/obj/vec/is/sf/impls/basic/cuda/sfcuda.o
>    CUDAC.dep
> arch-summit-hypre-cuda-dbg/obj/vec/is/sf/impls/basic/cuda/sfcuda.o
>      CLINKER arch-summit-hypre-cuda-dbg/lib/libpetsc.so.3.015.3
> arch-summit-hypre-cuda-dbg/obj/sys/objects/device/impls/cupm/cuda/cupmcontext.o:(.rodata._ZN5Petsc13CUPMInterfaceILNS_14CUPMDeviceKindE0EE21cupmStreamNonBlockingE[_ZN5Petsc13CUPMInterfaceILNS_14CUPMDeviceKindE0EE21cupmStreamNonBlockingE]+0x0):
> multiple definition of
> `Petsc::CUPMInterface<(Petsc::CUPMDeviceKind)0>::cupmStreamNonBlocking'
> arch-summit-hypre-cuda-dbg/obj/sys/objects/device/interface/cupminterface.o:(.rodata+0x44):
> first defined here
> /usr/bin/ld: link errors found, deleting executable
> `arch-summit-hypre-cuda-dbg/lib/libpetsc.so.3.015.3'
> collect2: error: ld returned 1 exit status
> gmake[3]: *** [gmakefile:113:
> arch-summit-hypre-cuda-dbg/lib/libpetsc.so.3.015.3] Error 1
> gmake[2]: ***
> [/gpfs/alpine/csc314/scratch/adams/petsc2/lib/petsc/conf/rules:50: libs]
> Error 2
> **************************ERROR*************************************
>   Error during compile, check
> arch-summit-hypre-cuda-dbg/lib/petsc/conf/make.log
>   Send it and arch-summit-hypre-cuda-dbg/lib/petsc/conf/configure.log to
> petsc-maint at mcs.anl.gov
> ********************************************************************
> gmake[1]: *** [makefile:40: all] Error 1
>
> On Mon, Aug 30, 2021 at 10:50 AM Mark Adams <mfadams at lbl.gov> wrote:
>
>> Stefano suggested C++14 in configure. I was using C++11.
>>
>> On Mon, Aug 30, 2021 at 10:46 AM Junchao Zhang <junchao.zhang at gmail.com>
>> wrote:
>>
>>>  Petsc::CUPMInterface
>>> @Jacob Faibussowitsch <jacob.fai at gmail.com>
>>> --Junchao Zhang
>>>
>>>
>>> On Mon, Aug 30, 2021 at 9:35 AM Mark Adams <mfadams at lbl.gov> wrote:
>>>
>>>> I was running fine this AM and am bouncing between modules to help two
>>>> apps (ECP milestone season) at the same time and something broke. I did
>>>> update main and I get the same error in main and a hypre branch of
>>>> Stefano's.
>>>> I started with a clean build and checked my modules...
>>>> Any ideas?
>>>>
>>>> Thanks,
>>>> Mark
>>>>
>>>>        CC arch-summit-hypre-cuda-dbg/obj/tao/interface/taosolver.o
>>>>           CC arch-summit-hypre-cuda-dbg/obj/ts/interface/ts.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/dense/seq/cuda/densecuda.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/dense/seq/cuda/densecuda.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/aij/seq/seqcusparse/aijcusparseband.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/aij/seq/seqcusparse/aijcusparseband.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/ts/utils/dmplexlandau/cuda/landaucu.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/ts/utils/dmplexlandau/cuda/landaucu.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/vec/vec/impls/seq/seqcuda/veccuda2.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/vec/vec/impls/seq/seqcuda/veccuda2.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/aij/mpi/mpicusparse/mpiaijcusparse.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/aij/seq/seqcusparse/aijcusparse.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/mat/impls/aij/seq/seqcusparse/aijcusparse.o
>>>>        CUDAC
>>>> arch-summit-hypre-cuda-dbg/obj/vec/is/sf/impls/basic/cuda/sfcuda.o
>>>>    CUDAC.dep
>>>> arch-summit-hypre-cuda-dbg/obj/vec/is/sf/impls/basic/cuda/sfcuda.o
>>>>      CLINKER arch-summit-hypre-cuda-dbg/lib/libpetsc.so.3.015.3
>>>> arch-summit-hypre-cuda-dbg/obj/sys/objects/device/impls/cupm/cuda/cupmcontext.o:(.rodata._ZN5Petsc13CUPMInterfaceILNS_14CUPMDeviceKindE0EE21cupmStreamNonBlockingE[_ZN5Petsc13CUPMInterfaceILNS_14CUPMDeviceKindE0EE21cupmStreamNonBlockingE]+0x0):
>>>> multiple definition of
>>>> `Petsc::CUPMInterface<(Petsc::CUPMDeviceKind)0>::cupmStreamNonBlocking'
>>>> arch-summit-hypre-cuda-dbg/obj/sys/objects/device/interface/cupminterface.o:(.rodata+0x44):
>>>> first defined here
>>>> /usr/bin/ld: link errors found, deleting executable
>>>> `arch-summit-hypre-cuda-dbg/lib/libpetsc.so.3.015.3'
>>>> collect2: error: ld returned 1 exit status
>>>> gmake[3]: *** [gmakefile:113:
>>>> arch-summit-hypre-cuda-dbg/lib/libpetsc.so.3.015.3] Error 1
>>>> gmake[2]: ***
>>>> [/gpfs/alpine/csc314/scratch/adams/petsc2/lib/petsc/conf/rules:50: libs]
>>>> Error 2
>>>> **************************ERROR*************************************
>>>>   Error during compile, check
>>>> arch-summit-hypre-cuda-dbg/lib/petsc/conf/make.log
>>>>   Send it and arch-summit-hypre-cuda-dbg/lib/petsc/conf/configure.log
>>>> to petsc-maint at mcs.anl.gov
>>>> ********************************************************************
>>>> gmake[1]: *** [makefile:40: all] Error 1
>>>> make: *** [GNUmakefile:9: all] Error 2
>>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20210830/b37dee57/attachment-0001.html>


More information about the petsc-dev mailing list