|
From: Murphy, J. T. <jtm...@an...> - 2011-07-28 13:03:53
|
Kashif,
As I have been writing this e-mail you have just sent me another that says:
---------------------------------
The error below happens only with virtual void setup(repast::Properties
props) in header as it was and in definition virtual void
setup(repast::Properties& props)...
Also we have to include following two lines:
using repast::relogo::Observer::setup;
using repast::relogo::Observer::go;
----------------------------------
I'm afraid I can't understand what you are saying; can you try to
rephrase? The declaration in the header and the definition in the
implementation must match signatures (but the definition should not have
the 'virtual' keyword); it looks like you are saying that that the error
occurs when they do not- one has the & and the other doesn't- but I would
expect an error of some kind to occur in that case.
Meanwhile, here is my response to your earlier comments......
I'm in unfamiliar territory, but I think that the 'using' keyword is not
solving the problem and may be causing more confusion. It makes it appear
that the compilation is working because it gets past the declaration of
the methods, but it leaves ambiguities that the compiler later cannot
resolve, leading to the other errors you are getting and that you
described in your earlier e-mails (including, possibly, the linker errors
('undefined reference'; the 'undefined reference to vtable' error is
almost certainly related to the compilation issue). The 'using' keyword
should not be needed for the functionality that is intended- overriding a
virtual function. (The 'using' keyword can help resolve ambiguities among
functions with similar, but different, signatures; overriding a virtual
function, as is the intent of the Repast HPC code, requires that the
signatures be identical.)
The mismatch in the original code and Zombies example between the method
signatures (with & in the base class and without it in the derived class)
is a definite error that we will correct in the SVN version; my hunch is
that all problems stem from this. There is also a difference in the way
the Intel compiler handles virtual overrides, but the clearest way to test
this is with minimal examples: I would try to create simple examples of
base classes and derived classes with identical and similar signatures
(and also pure virtual functions declared with =0, as the 'go' method is,
vs. declared and defined, as 'setup' is) and see how your regular compiler
(VS) handles this vs. the Intel compiler.
But as I've said, I don't have an Intel compiler to try this on. I'll try
to get a chance to scour the web for information today. If you get the
chance to keep trying different variations, let us know. Your feedback on
this is very helpful!
Best,
John
--
John T. Murphy
Computational Postdoctoral Fellow
Decision and Information Sciences and
Argonne Leadership Computing Facility
Argonne National Laboratory
jtm...@an...
On 7/28/11 7:02 AM, "Kashif Zia" <ka...@pe...> wrote:
>John,
>
>Nothing happens with addition of virtual and & as suggested. However if I
>include following two statements just before declaration of both
>functions,
>the error is changed:
>
>using repast::relogo::Observer::setup;
>using repast::relogo::Observer::go;
>
>k330174@service0:~/sim/src/zombie> icpc main.cpp -lboost_mpi
>-lboost_filesystem -lrepast_hpc-1.0 -lrelogo-1.0 -lmpi -lnetcdf_c++
>/apps/repasthpc-1.0b/include/relogo/SimulationRunner.h(116): error: more
>than one instance of overloaded function "ZombieObserver::setup" matches
>the
>argument list:
> function "repast::relogo::Observer::setup(repast::Properties
>&)"
> function "ZombieObserver::setup(repast::Properties)"
> argument types are: (repast::Properties)
> object type is: ZombieObserver
> obs->setup(props);
> ^
> detected during instantiation of "void
>repast::relogo::SimulationRunner::run<ObserverType,PatchType>(repast::Prop
>er
>ties &) [with ObserverType=ZombieObserver,
>PatchType=repast::relogo::Patch]"
>at line 57 of "main.cpp"
>
>
>Please also go through my earlier comments on the thread about step by
>step
>compiliation.
>
>Best
>---
>Kashif Zia
>
>PhD Candidate
>Institut für Pervasive Computing, Johannes Kepler Universität Linz,
>Altenberger Straße 69, A-4040 Linz
>Room: P105, Phone: +43-732-2468-9673, Fax: +43-732-2468-8426
>E-Mail: ka...@pe...
>
>
>-----Original Message-----
>From: Murphy, John T. [mailto:jtm...@an...]
>Sent: Thursday, July 28, 2011 1:50 PM
>To: rep...@li...
>Subject: Re: [Repast-interest] Repast HPC: compilation on Linux (icc)
>isuues
>
>Kashif,
>
>Thanks for continuing to track down these errors; it's very useful to know
>how RepastHPC and the demo models will compile- or will not compile- on
>different compilers than the ones we have in-house here at Argonne.
>
>Try making these changes to ZombieObserver.h:
>
>void setup(repast::Properties props);
>
>Should be changed to:
>
>virtual void setup(repast::Properties& props);
>
>And:
>
>void go();
>
>Should be changed to:
>
>virtual void go();
>
>Additionally, change the signature of the setup method in
>ZombieObserver.cpp
>to match the declaration in ZombieObserver.h by including the &:
>
>
>void ZombieObserver::setup(Properties& props) {
>
>There are also two changes being made here: the addition of the 'virtual'
>keyword, which is applied to both the 'setup' and the 'go' method, and the
>change to the method signature of 'setup', which should receive a
>reference.
>
>Let us know if these work- best,
>John
>
>--
>John T. Murphy
>Computational Postdoctoral Fellow
>Decision and Information Sciences and
>Argonne Leadership Computing Facility
>Argonne National Laboratory
>jtm...@an...
>
>From: Kashif Zia <ka...@pe...<mailto:ka...@pe...>>
>Date: Thu, 28 Jul 2011 03:00:10 -0500
>To:
>"rep...@li...<mailto:rep...@li...
>fo
>rge.net>"
><rep...@li...<mailto:rep...@li...
>fo
>rge.net>>
>Subject: [Repast-interest] Repast HPC: compilation on Linux (icc) isuues
>
>Hello Everyone
>
>Trying to compile zombie_model on Linux using Intel C.
>
>First I recognized that in icc, the virtual functions overriding is not
>supported as I have understanding of it. For example: in ZombieObserver.h
>
>The functions:
>
> void go();
> void setup(repast::Properties props);
>
>should work as it is, but the following error was generated:
>
>icpc main.cpp -lboost_mpi -lboost_filesystem -lrepast_hpc-1.0 -lrelogo-1.0
>-lmpi -lnetcdf_c++
>ZombieObserver.h(64): warning #1125: function
>"repast::relogo::Observer::setup(repast::Properties &)" is hidden by
>"ZombieObserver::setup" -- virtual function override intended?
> void setup(repast::Properties props);
> ^
>
>/usr/lib64/sgi/intel9/libimf.so: warning: warning: feupdateenv is not
>implemented and will always fail
>ld: warning: libboost_filesystem.so.1.33.1, needed by
>/apps/repasthpc-1.0b/lib/librepast_hpc-1.0.so, may conflict with
>libboost_filesystem.so.1.45.0
>/tmp/icpclI4dfT.o: In function `void
>repast::relogo::SimulationRunner::run<ZombieObserver,
>repast::relogo::Patch>(repast::Properties&)':
>main.cpp:(.gnu.linkonce.t._ZN6repast6relogo16SimulationRunner3runI14Zombie
>Ob
>serverNS0_5PatchEEEvRNS_10PropertiesE[.gnu.linkonce.t._ZN6repast6relogo16S
>im
>ulationRunner3runI14ZombieObserverNS0_5PatchEEEvRNS_10PropertiesE]+0x6f2):
>undefined reference to `ZombieObserver::setup(repast::Properties)'
>/tmp/icpclI4dfT.o: In function `ZombieObserver*
>repast::relogo::WorldCreator::createWorld<ZombieObserver,
>repast::relogo::Patch,
>repast::relogo::DefaultAgentCreator<repast::relogo::Patch>
>>(repast::relogo::WorldDefinition const&, std::vector<int,
>std::allocator<int> > const&,
>repast::relogo::DefaultAgentCreator<repast::relogo::Patch>&)':
>main.cpp:(.gnu.linkonce.t._ZN6repast6relogo12WorldCreator11createWorldI14Z
>om
>bieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEEEPT_RKNS0_15WorldDef
>in
>itionERKSt6vectorIiSaIiEERT1_[.gnu.linkonce.t._ZN6repast6relogo12WorldCrea
>to
>r11createWorldI14ZombieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEE
>EP
>T_RKNS0_15WorldDefinitionERKSt6vectorIiSaIiEERT1_]+0x74): undefined
>reference to `vtable for ZombieObserver'
>make: *** [default] Error 1
>
>After searching for two hours, I came to know that some intel compilers
>model need explicit mention of virtual functions. So I added the following
>line:
>
> using repast::relogo::Observer::setup;
> void go();
> void setup(repast::Properties props);
>
>Still not successful and faced the following error:
>
>k330174@service0:~/sim/src/zombie> make
>icpc main.cpp -lboost_mpi -lboost_filesystem -lrepast_hpc-1.0 -lrelogo-1.0
>-lmpi -lnetcdf_c++
>/apps/repasthpc-1.0b/include/relogo/SimulationRunner.h(116): error: more
>than one instance of overloaded function "ZombieObserver::setup" matches
>the
>argument list:
> function "repast::relogo::Observer::setup(repast::Properties
>&)"
> function "ZombieObserver::setup(repast::Properties)"
> argument types are: (repast::Properties)
> object type is: ZombieObserver
> obs->setup(props);
> ^
> detected during instantiation of "void
>repast::relogo::SimulationRunner::run<ObserverType,PatchType>(repast::Prop
>er
>ties &) [with ObserverType=ZombieObserver,
>PatchType=repast::relogo::Patch]"
>at line 57 of "main.cpp"
>
>compilation aborted for main.cpp (code 2)
>make: *** [default] Error 2
>
>It seemed that there is some problem with intel during its handling with
>dynamic binding. Look at:
>http://octave.1599824.n4.nabble.com/Compiling-Octave-3-2-3-with-icpc-10-1-
>fa
>ils-more-than-one-instance-of-overloaded-function-quot-octav-td2327457.htm
>l
>
>So I simply changed the function name entirely (from setup to setup1). Now
>the above errors are removed, but still not able to compile. See recent
>errors below:
>
>k330174@service0:~/sim/src/zombie> make
>icpc main.cpp -lboost_mpi -lboost_filesystem -lrepast_hpc-1.0 -lrelogo-1.0
>-lmpi -lnetcdf_c++
>/usr/lib64/sgi/intel9/libimf.so: warning: warning: feupdateenv is not
>implemented and will always fail
>ld: warning: libboost_filesystem.so.1.33.1, needed by
>/apps/repasthpc-1.0b/lib/librepast_hpc-1.0.so, may conflict with
>libboost_filesystem.so.1.45.0
>/tmp/icpcefhQ0V.o: In function `ZombieObserver*
>repast::relogo::WorldCreator::createWorld<ZombieObserver,
>repast::relogo::Patch,
>repast::relogo::DefaultAgentCreator<repast::relogo::Patch>
>>(repast::relogo::WorldDefinition const&, std::vector<int,
>std::allocator<int> > const&,
>repast::relogo::DefaultAgentCreator<repast::relogo::Patch>&)':
>main.cpp:(.gnu.linkonce.t._ZN6repast6relogo12WorldCreator11createWorldI14Z
>om
>bieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEEEPT_RKNS0_15WorldDef
>in
>itionERKSt6vectorIiSaIiEERT1_[.gnu.linkonce.t._ZN6repast6relogo12WorldCrea
>to
>r11createWorldI14ZombieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEE
>EP
>T_RKNS0_15WorldDefinitionERKSt6vectorIiSaIiEERT1_]+0x74): undefined
>reference to `vtable for ZombieObserver'
>make: *** [default] Error 1
>
>Changing the function name probably will work as it is the highest level
>function. However it need to remove the remaining errors first.
>
>Any ideas?
>
>Thanks and Regards.
>
>
>---
>Kashif Zia
>
>PhD Candidate
>Institut für Pervasive Computing, Johannes Kepler Universität Linz,
>Altenberger Straße 69, A-4040 Linz
>Room: P105, Phone: +43-732-2468-9673, Fax: +43-732-2468-8426
>E-Mail: ka...@pe...<mailto:ka...@pe...>
>
>
>--------------------------------------------------------------------------
>--
>--
>Got Input? Slashdot Needs You.
>Take our quick survey online. Come on, we don't ask for help often.
>Plus, you'll get a chance to win $100 to spend on ThinkGeek.
>http://p.sf.net/sfu/slashdot-survey
>_______________________________________________
>Repast-interest mailing list
>Rep...@li...
>https://lists.sourceforge.net/lists/listinfo/repast-interest
>
>
|