|
From: Kashif Z. <ka...@pe...> - 2011-07-28 11:43:21
|
Dear All
The problem is weird. I started a step by step compilation, starting with
header files only. Following is the sequence of inclusions:
FollowingObserver.h
AgentPackage.h
patchExt.h or Patch.h
Each file compiled individually.
Then I compiled main.cpp. It compiles unless I enable the statement:
runner.run<FollowingObserver, patchExt>(props); which generates following
error:
k330174@service0:~/sim/src/following> icpc main.cpp -lboost_mpi
-lboost_filesystem -lrepast_hpc-1.0 -lrelogo-1.0 -lmpi -lnetcdf_c++
FollowingObserver.h(29): warning #1125: function
"repast::relogo::Observer::setup(repast::Properties &)" is hidden by
"FollowingObserver::setup" -- virtual function override intended?
void setup(repast::Properties props); // Setting up simulation
^
/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/icpcM2fXnu.o: In function `void
repast::relogo::SimulationRunner::run<FollowingObserver,
patchExt>(repast::Properties&)':
main.cpp:(.gnu.linkonce.t._ZN6repast6relogo16SimulationRunner3runI17Followin
gObserver8patchExtEEvRNS_10PropertiesE[.gnu.linkonce.t._ZN6repast6relogo16Si
mulationRunner3runI17FollowingObserver8patchExtEEvRNS_10PropertiesE]+0x6f2):
undefined reference to `FollowingObserver::setup(repast::Properties)'
/tmp/icpcM2fXnu.o: In function `FollowingObserver*
repast::relogo::WorldCreator::createWorld<FollowingObserver, patchExt,
repast::relogo::DefaultAgentCreator<patchExt>
>(repast::relogo::WorldDefinition const&, std::vector<int,
std::allocator<int> > const&,
repast::relogo::DefaultAgentCreator<patchExt>&)':
main.cpp:(.gnu.linkonce.t._ZN6repast6relogo12WorldCreator11createWorldI17Fol
lowingObserver8patchExtNS0_19DefaultAgentCreatorIS4_EEEEPT_RKNS0_15WorldDefi
nitionERKSt6vectorIiSaIiEERT1_[.gnu.linkonce.t._ZN6repast6relogo12WorldCreat
or11createWorldI17FollowingObserver8patchExtNS0_19DefaultAgentCreatorIS4_EEE
EPT_RKNS0_15WorldDefinitionERKSt6vectorIiSaIiEERT1_]+0x74): undefined
reference to `vtable for FollowingObserver'
Following is listing of all these files.
FollowingObserver.h:
/*
Header file for Model Observer; creating agent, commnads at agentset level
etc.
Has to be inherited from Observer class
started on july 13, 2011
Author: Kashif
*/
#include "relogo/Observer.h"
#include "repast_hpc/AgentRequest.h"
#include "repast_hpc/Properties.h"
//#include "relogo/AgentSet.h"
#include "AgentPackage.h"
using namespace std;
class FollowingObserver : public repast::relogo::Observer {
private:
repast::Properties props; // properites for creating agents ; setting
simulation
int AmIType, nonAmIType; // Agents breeds
int _saveCount; // global variable at all-agents level
public:
FollowingObserver() : _saveCount(0) {}
virtual ~FollowingObserver() {}
//higher level observer
void setup(repast::Properties props); // Setting up simulation
void go(); // what to do at each iteration
//sub-observers
void setupPatches();
void initializeAmIDir();
void intializeLeaders();
void proximityCalc();
//PRINT
void printnonAmI();
void printAmI();
void printPatches();
// create and provide for agents moving between processes
repast::relogo::RelogoAgent* createAgent(const AgentPackage& content);
void provideContent(const repast::AgentRequest& request,
std::vector<AgentPackage>& out);
// create and provide for buffer sync
void createAgents(std::vector<AgentPackage>& content,
std::vector<repast::relogo::RelogoAgent*>& out);
void provideContent(repast::relogo::RelogoAgent* agent,
std::vector<AgentPackage>& out);
//SETTING UP GLOBAL PARAMETER: SAVED
void incrementsaveCount() {
_saveCount++;
}
int saveCount() const {
return _saveCount;
}
};
AgentPackage.h:
#pragma once
#include "repast_hpc/AgentId.h"
using namespace repast;
//using namespace relogo;
struct AgentPackage {
template<class Archive>
void serialize(Archive& ar, const unsigned int version) {
ar & id;
ar & proc;
ar & type;
ar & ort; // both agent types
ar & targetPID; // AmI
//nonAmI
ar & leaderID;
ar & prox_dummy;
ar & isTunnel;
}
int id, proc, type;
float ort;
AgentId targetPID;
AgentId leaderID;
double prox_dummy;
int isTunnel;
repast::AgentId getId() const {
return repast::AgentId(id, proc, type);
}
};
patchExt.h or Patch.h:
/*
Header file for Patch Extentions to include structure
Has to be inherited from Patch class
started on july 13, 2011
Author: Kashif
*/
#include "relogo/Patch.h"
#include "AgentPackage.h"
class patchExt : public repast::relogo::Patch {
private:
int _isTunnel; // patch variables
public:
patchExt(repast::AgentId id, repast::relogo::Observer* obs):
repast::relogo::Patch(id, obs), _isTunnel(-1) {} // overriden Turtle
constructor
patchExt(repast::AgentId id, repast::relogo::Observer* obs, const
AgentPackage& package): repast::relogo::Patch(id, obs),
_isTunnel(package.isTunnel) {}
virtual ~patchExt() {}
void resetPatch();
void applyn();
void printPatch();
int isTunnel() const { // get variable
return _isTunnel;
}
};
Main.cpp:
/*
Main program
*/
#include <boost/mpi.hpp>
#include "repast_hpc/RepastProcess.h"
#include "relogo/SimulationRunner.h"
#include "patchExt.h"
#include "FollowingObserver.h"
namespace mpi = boost::mpi;
using namespace repast;
using namespace relogo;
void usage() {
std::cerr << "usage: X string string" << std::endl;
std::cerr << " first string: string is the path to the Repast HPC
\n\tconfiguartion properties file"
<< std::endl;
std::cerr << " second string: string is the path to the model
properties file" << std::endl;
}
void runFollowing(std::string propsFile) {
Properties props(propsFile);
SimulationRunner runner;
//runner.run<FollowingObserver, patchExt>(props);
runner.run<FollowingObserver, patchExt>(props);
//std::cerr << "******** RUNNING PROPERLY*********" << std::endl;
}
int main(int argc, char **argv) {
mpi::environment env(argc, argv);
std::string config, props;
mpi::communicator world;
if (argc == 3) {
// assume short args where first arg is the config, and second
is model properties
config = argv[1];
props = argv[2];
} else {
//std::cerr << "usage: X CALLED FROM POINT 1, MEANS ARGS NOT
3" << std::endl;
if (world.rank() == 0) usage();
return 0;
}
if (config.size() > 0 && props.size() > 0) {
RepastProcess::init(config);
runFollowing(props);
} else {
if (world.rank() == 0) usage();
return 0;
}
RepastProcess::instance()->done();
return 0;
}
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: <mailto:ka...@pe...> ka...@pe...
From: Kashif Zia [mailto:ka...@pe...]
Sent: Thursday, July 28, 2011 11:50 AM
To: 'Kashif Zia'; rep...@li...
Subject: RE: [Repast-interest] Repast HPC: compilation on Linux (icc) isuues
Also tried to compile rumor model, stuck in these errors:
k330174@service0:~/sim/src/rumor> 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/icpcRJuE4r.o: In function `main':
main.cpp:(.text+0x265): undefined reference to
`RumorModel::RumorModel(std::string const&)'
main.cpp:(.text+0x275): undefined reference to `RumorModel::init()'
main.cpp:(.text+0x28c): undefined reference to
`RumorModel::initSchedule(repast::ScheduleRunner&)'
/tmp/icpcRJuE4r.o: In function `runRumorModel(std::string)':
main.cpp:(.text+0x1369): undefined reference to
`RumorModel::RumorModel(std::string const&)'
main.cpp:(.text+0x1379): undefined reference to `RumorModel::init()'
main.cpp:(.text+0x1390): undefined reference to
`RumorModel::initSchedule(repast::ScheduleRunner&)'
---
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: <mailto:ka...@pe...> ka...@pe...
From: Kashif Zia [mailto:ka...@pe...]
Sent: Thursday, July 28, 2011 10:00 AM
To: rep...@li...
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._ZN6repast6relogo16SimulationRunner3runI14ZombieOb
serverNS0_5PatchEEEvRNS_10PropertiesE[.gnu.linkonce.t._ZN6repast6relogo16Sim
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._ZN6repast6relogo12WorldCreator11createWorldI14Zom
bieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEEEPT_RKNS0_15WorldDefin
itionERKSt6vectorIiSaIiEERT1_[.gnu.linkonce.t._ZN6repast6relogo12WorldCreato
r11createWorldI14ZombieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEEEP
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::Proper
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.html
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._ZN6repast6relogo12WorldCreator11createWorldI14Zom
bieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEEEPT_RKNS0_15WorldDefin
itionERKSt6vectorIiSaIiEERT1_[.gnu.linkonce.t._ZN6repast6relogo12WorldCreato
r11createWorldI14ZombieObserverNS0_5PatchENS0_19DefaultAgentCreatorIS4_EEEEP
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: <mailto:ka...@pe...> ka...@pe...
|