Open einola opened 2 days ago
My own attempt at compiling develop with intel also fail.
[einola@login-2.FRAM ~/src/nextsimdg/intel]$ icpc --version
icpc (ICC) 2021.6.0 20220226
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
[ 67%] Building CXX object CMakeFiles/nextsimlib.dir/physics/src/modules/OceanBoundaryModule/ConfiguredOcean.cpp.o
/cluster/home/einola/src/nextsimdg/dynamics/src/include/CGDynamicsKernel.hpp(38): error: the default constructor of "Nextsim::DynamicsKernel<6, 8>" cannot be referenced -- it is a deleted function
{
^
detected during:
instantiation of "Nextsim::CGDynamicsKernel<DGadvection>::CGDynamicsKernel() [with DGadvection=6]" at line 37 of "/cluster/home/einola/src/nextsimdg/dynamics/src/include/FreeDriftDynamicsKernel.hpp"
instantiation of "Nextsim::FreeDriftDynamicsKernel<DGadvection>::FreeDriftDynamicsKernel(const Nextsim::DynamicsParameters &) [with DGadvection=6]" at line 26 of "/cluster/home/einola/src/nextsimdg/core/src/modules/DynamicsModule/include/FreeDriftDynamics.hpp"
[ 68%] Building CXX object CMakeFiles/nextsimlib.dir/physics/src/modules/OceanBoundaryModule/FluxConfiguredOcean.cpp.o
[ 69%] Building CXX object CMakeFiles/nextsimlib.dir/physics/src/modules/OceanBoundaryModule/TOPAZOcean.cpp.o
[ 70%] Building CXX object CMakeFiles/nextsimlib.dir/physics/src/modules/OceanBoundaryModule/UniformOcean.cpp.o
[ 71%] Building CXX object CMakeFiles/nextsimlib.dir/physics/src/modules/OceanBoundaryModule/module.cpp.o
compilation aborted for /cluster/home/einola/src/nextsimdg/core/src/modules/DynamicsModule/module.cpp (code 2)
make[2]: *** [CMakeFiles/nextsimlib.dir/build.make:510: CMakeFiles/nextsimlib.dir/core/src/modules/DynamicsModule/module.cpp.o] Error 2
make[2]: *** Waiting for unfinished jobs....
/cluster/home/einola/src/nextsimdg/dynamics/src/include/CGDynamicsKernel.hpp(38): error: the default constructor of "Nextsim::DynamicsKernel<6, 8>" cannot be referenced -- it is a deleted function
{
^
detected during:
instantiation of "Nextsim::CGDynamicsKernel<DGadvection>::CGDynamicsKernel() [with DGadvection=6]" at line 55 of "/cluster/home/einola/src/nextsimdg/dynamics/src/include/VPCGDynamicsKernel.hpp"
instantiation of "Nextsim::VPCGDynamicsKernel<DGadvection>::VPCGDynamicsKernel(Nextsim::StressUpdateStep<DGadvection, 8> &, const Nextsim::DynamicsParameters &) [with DGadvection=6]" at line 25 of "/cluster/home/einola/src/nextsimdg/dynamics/src/include/MEVPDynamicsKernel.hpp"
instantiation of "Nextsim::MEVPDynamicsKernel<DGadvection>::MEVPDynamicsKernel(const Nextsim::DynamicsParameters &) [with DGadvection=6]" at line 25 of "/cluster/home/einola/src/nextsimdg/core/src/modules/DynamicsModule/MEVPDynamics.cpp"
compilation aborted for /cluster/home/einola/src/nextsimdg/core/src/modules/DynamicsModule/MEVPDynamics.cpp (code 2)
make[2]: *** [CMakeFiles/nextsimlib.dir/build.make:496: CMakeFiles/nextsimlib.dir/core/src/modules/DynamicsModule/MEVPDynamics.cpp.o] Error 2
/cluster/home/einola/src/nextsimdg/dynamics/src/include/CGDynamicsKernel.hpp(38): error: the default constructor of "Nextsim::DynamicsKernel<6, 8>" cannot be referenced -- it is a deleted function
{
^
detected during:
instantiation of "Nextsim::CGDynamicsKernel<DGadvection>::CGDynamicsKernel() [with DGadvection=6]" at line 60 of "/cluster/home/einola/src/nextsimdg/dynamics/src/include/BrittleCGDynamicsKernel.hpp"
instantiation of "Nextsim::BrittleCGDynamicsKernel<DGadvection>::BrittleCGDynamicsKernel(Nextsim::StressUpdateStep<DGadvection, 8> &, const Nextsim::DynamicsParameters &) [with DGadvection=6]" at line 30 of "/cluster/home/einola/src/nextsimdg/dynamics/src/include/BBMDynamicsKernel.hpp"
instantiation of "Nextsim::BBMDynamicsKernel<DGadvection>::BBMDynamicsKernel(const Nextsim::DynamicsParameters &) [with DGadvection=6]" at line 17 of "/cluster/home/einola/src/nextsimdg/core/src/modules/DynamicsModule/BBMDynamics.cpp"
compilation aborted for /cluster/home/einola/src/nextsimdg/core/src/modules/DynamicsModule/BBMDynamics.cpp (code 2)
make[2]: *** [CMakeFiles/nextsimlib.dir/build.make:482: CMakeFiles/nextsimlib.dir/core/src/modules/DynamicsModule/BBMDynamics.cpp.o] Error 2
make[1]: *** [CMakeFiles/Makefile2:279: CMakeFiles/nextsimlib.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
However, simply changing DynamicsKernel() = default
to DynamicsKernel() {}
in DynamicsKernel.hpp lets the code compile (but with some warnings for CGModelArray_test.cpp).
diff --git a/dynamics/src/include/DynamicsKernel.hpp b/dynamics/src/include/DynamicsKernel.hpp
index 63ba93e4..36fe7dee 100644
--- a/dynamics/src/include/DynamicsKernel.hpp
+++ b/dynamics/src/include/DynamicsKernel.hpp
@@ -41,7 +41,7 @@ public:
typedef std::pair<const std::string, const DGVector<DGadvection>&> DataMapping;
typedef std::map<typename DataMapping::first_type, typename DataMapping::second_type> DataMap;
- DynamicsKernel() = default;
+ DynamicsKernel() {};
virtual ~DynamicsKernel() = default;
virtual void initialise(const ModelArray& coords, bool isSpherical, const ModelArray& mask)
{
@timspainNERSC: Shouldn't the two be equivalent, or is there a subtle difference?
@timspainNERSC: Shouldn't the two be equivalent, or is there a subtle difference? 😬🤷
I'll have a quick investigate, but as I understand it, the two should be equivalent.
They are so not equivalent. The default constructor = default
will initialize everything with its default value (zeroes, default constructors). An empty constructor {}
explicitly says: We initialize nothing! Nothing! Good day, sir!
I did manage to remove a warning in Eclipse by initializing all the fields in DynamicsKernel.
diff --git a/dynamics/src/include/DynamicsKernel.hpp b/dynamics/src/include/DynamicsKernel.hpp
index 63ba93e..2f68eef 100644
--- a/dynamics/src/include/DynamicsKernel.hpp
+++ b/dynamics/src/include/DynamicsKernel.hpp
@@ -168,7 +168,7 @@
}
protected:
- Nextsim::DGTransport<DGadvection>* dgtransport;
+ Nextsim::DGTransport<DGadvection>* dgtransport = nullptr;
DGVector<DGadvection> hice;
DGVector<DGadvection> cice;
@@ -181,9 +181,9 @@
size_t stepNumber = 0;
- double deltaT;
+ double deltaT = 0.;
- Nextsim::ParametricMesh* smesh;
+ Nextsim::ParametricMesh* smesh = nullptr;
virtual void updateMomentum(const TimestepTime& tst) = 0;
Does that allow ICC to build DynamicsKernel? (With the = default
constructor)
Ah, good to know about = default
!
But it still doesn't compile. It's strange because the compiler says, "You deleted the constructor, so I can't call it" if we use = default
but not if we use an empty constructor. But both are valid constructors and not deleted, right?!
I did find something potentially relevant on stackoverflow. It's about a bug in Visual Studio 2015, which seems to have been fixed*, but the accepted answer lists conditions under which a default constructor is deleted. Unfortunately, I can't tell if any of these are true for us.
*I verified that the MWE on stackoverflow compiles with my setup.
@andreapiacentini is having problems compiling the code using the intel suite of compilers. Andrea reports
In the meantime, the simple sequence of commands
miserably ended very soon (much sooner than what happened with Eric's old branch even if ConfigMap.hpp is unchanged) I definitely need a little push toward c++ and cmake misteries (both far more modern than I am)