Skip to content
Snippets Groups Projects
Commit c1b1723b authored by pospelov's avatar pospelov
Browse files

Final fix with compilation at JCNS, new README with installation instructions,...

Final fix with compilation at JCNS, new README with installation instructions, special profile call for TestFactory.
parent 2bcd5540
No related branches found
No related tags found
No related merge requests found
...@@ -85,14 +85,12 @@ macx { ...@@ -85,14 +85,12 @@ macx {
LIBS += -lgsl -lgslcblas -lfftw3 -lboost_system -lboost_filesystem -lboost_regex LIBS += -lgsl -lgslcblas -lfftw3 -lboost_system -lboost_filesystem -lboost_regex
# here is workaround since JCNS /usr/local doesn't have shared fftw3 # here is workaround since JCNS /usr/local doesn't have shared fftw3
#LIBS += -lgsl -lgslcblas -lboost_system -lboost_filesystem -lboost_regex # qmake CONFIG+=JCNS
#macx { CONFIG(JCNS) {
# LIBS += -lfftw3 LIBS -= -lfftw3
#} LIBS += -Bstatic -lfftw3 -Bdynamic # request for static (without fPIC option)
#!macx:unix { # "-lfftw3f" - with fPIC option, "-lfftw3" - without fPIC option
# # telling linker to link with static version of the library with fPIC option }
# LIBS += -Bstatic -lfftw3f -Bdynamic
#}
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
......
...@@ -32,6 +32,9 @@ public: ...@@ -32,6 +32,9 @@ public:
//! execute specified test //! execute specified test
void execute(std::string name); void execute(std::string name);
//! profile specified test
void profile(std::string name);
//! execute all registered tests //! execute all registered tests
void execute_all(); void execute_all();
......
...@@ -28,7 +28,10 @@ class TestIsGISAXS9 : public IFunctionalTest ...@@ -28,7 +28,10 @@ class TestIsGISAXS9 : public IFunctionalTest
public: public:
TestIsGISAXS9(); TestIsGISAXS9();
virtual ~TestIsGISAXS9(); virtual ~TestIsGISAXS9();
virtual void initialise();
virtual void execute(); virtual void execute();
virtual void finalise();
private: private:
void initializeSample(); void initializeSample();
......
...@@ -22,6 +22,7 @@ CommandLine::CommandLine(int argc, char **argv) : m_argc(argc), m_argv(argv) ...@@ -22,6 +22,7 @@ CommandLine::CommandLine(int argc, char **argv) : m_argc(argc), m_argv(argv)
m_defined_arguments.push_back("batch"); m_defined_arguments.push_back("batch");
m_defined_arguments.push_back("pdfreport"); m_defined_arguments.push_back("pdfreport");
m_defined_arguments.push_back("all"); m_defined_arguments.push_back("all");
m_defined_arguments.push_back("profile");
// getting info about names of defined functional tests and adding them to the list of defined arguments // getting info about names of defined functional tests and adding them to the list of defined arguments
m_defined_functional_tests = TestFactory::instance().get_testnames(); m_defined_functional_tests = TestFactory::instance().get_testnames();
m_defined_arguments.insert(m_defined_arguments.end(), m_defined_functional_tests.begin(), m_defined_functional_tests.end()); m_defined_arguments.insert(m_defined_arguments.end(), m_defined_functional_tests.begin(), m_defined_functional_tests.end());
...@@ -33,6 +34,7 @@ CommandLine::CommandLine(int argc, char **argv) : m_argc(argc), m_argv(argv) ...@@ -33,6 +34,7 @@ CommandLine::CommandLine(int argc, char **argv) : m_argc(argc), m_argv(argv)
m_description["batch"] = "run application in batch mode (no graphics)"; m_description["batch"] = "run application in batch mode (no graphics)";
m_description["pdfreport"] = "generate pdf report for functional tests"; m_description["pdfreport"] = "generate pdf report for functional tests";
m_description["all"] = "run all registered functional test"; m_description["all"] = "run all registered functional test";
m_description["profile"] = "profile specified test";
// default description of functional tests // default description of functional tests
for(arguments_t::iterator it = m_defined_functional_tests.begin(); it!=m_defined_functional_tests.end(); ++it ) { for(arguments_t::iterator it = m_defined_functional_tests.begin(); it!=m_defined_functional_tests.end(); ++it ) {
m_description[ (*it) ] = "functional test: no description"; m_description[ (*it) ] = "functional test: no description";
...@@ -103,6 +105,7 @@ void CommandLine::print_help() ...@@ -103,6 +105,7 @@ void CommandLine::print_help()
std::cout << std::setw(15) << std::left << (*it) << " - " << m_description[(*it)] << std::endl; std::cout << std::setw(15) << std::left << (*it) << " - " << m_description[(*it)] << std::endl;
} }
std::cout << " " << std::endl; std::cout << " " << std::endl;
std::cout << "Example: ./App isgisaxs10 pdfreport batch " << std::endl; std::cout << "Example: ./App isgisaxs10 " << std::endl;
std::cout << "Example: ./App isgisaxs3 isgisaxs10 pdfreport batch " << std::endl;
} }
...@@ -63,14 +63,35 @@ void TestFactory::execute(std::string name) ...@@ -63,14 +63,35 @@ void TestFactory::execute(std::string name)
return; return;
} }
test->initialise();
m_benchmark->Start(name.c_str()); m_benchmark->Start(name.c_str());
test->execute(); test->execute();
m_benchmark->Stop(name.c_str()); m_benchmark->Stop(name.c_str());
m_benchmark->Show(name.c_str()); m_benchmark->Show(name.c_str());
test->finalise();
} }
void TestFactory::profile(std::string name)
{
//IFunctionalTest *test = TestFactory::instance().createItem( args[i] );
IFunctionalTest *test(0);
try {
test = createItem( name );
} catch (std::runtime_error &e) {
std::cout << e.what() << std::endl;
std::cout << "TestFactory::execute() -> Warning. No test with name '" << name << "' is defined." << std::endl;
return;
}
test->initialise();
for(int i=0; i<10; i++) test->execute();
}
/* ************************************************************************* */ /* ************************************************************************* */
// execute all registered functional tests // execute all registered functional tests
/* ************************************************************************* */ /* ************************************************************************* */
......
...@@ -30,9 +30,15 @@ TestIsGISAXS9::~TestIsGISAXS9() ...@@ -30,9 +30,15 @@ TestIsGISAXS9::~TestIsGISAXS9()
if(mp_intensity_output) delete mp_intensity_output; if(mp_intensity_output) delete mp_intensity_output;
} }
void TestIsGISAXS9::execute()
void TestIsGISAXS9::initialise()
{ {
initializeSample(); initializeSample();
}
void TestIsGISAXS9::execute()
{
GISASExperiment experiment; GISASExperiment experiment;
experiment.setSample(mp_sample); experiment.setSample(mp_sample);
experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100 experiment.setDetectorParameters(0.0*Units::degree, 2.0*Units::degree, 100
...@@ -44,6 +50,12 @@ void TestIsGISAXS9::execute() ...@@ -44,6 +50,12 @@ void TestIsGISAXS9::execute()
// saving results to file // saving results to file
IsGISAXSTools::writeOutputDataToFile(*mp_intensity_output, Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-9/this_pyramid_Z0.ima"); IsGISAXSTools::writeOutputDataToFile(*mp_intensity_output, Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-9/this_pyramid_Z0.ima");
}
void TestIsGISAXS9::finalise()
{
// reading result of IsGISAXS for comparison // reading result of IsGISAXS for comparison
OutputData<double> *isgi_data = IsGISAXSTools::readOutputDataFromFile(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-9/isgi_pyramid_Z0.ima"); OutputData<double> *isgi_data = IsGISAXSTools::readOutputDataFromFile(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-9/isgi_pyramid_Z0.ima");
......
...@@ -17,6 +17,15 @@ int main(int argc, char **argv) ...@@ -17,6 +17,15 @@ int main(int argc, char **argv)
CommandLine args(argc, argv); CommandLine args(argc, argv);
if( !args.isGood() ) { args.print_help(); return 0; } if( !args.isGood() ) { args.print_help(); return 0; }
// profiling code for memory leakages and cpu performance
if( args.find("profile") ) {
for(size_t i=0; i<args.size(); i++) {
if(args.isFunctionalTest( args[i] ))
TestFactory::instance().execute( args[i] );
}
return 0;
}
// setting graphics environment // setting graphics environment
TApplication theApp("theApp", 0, 0); TApplication theApp("theApp", 0, 0);
DrawHelper::SetStyle(); DrawHelper::SetStyle();
......
...@@ -193,15 +193,12 @@ macx { ...@@ -193,15 +193,12 @@ macx {
LIBS += -lgsl -lgslcblas -lfftw3 -lboost_system -lboost_filesystem -lboost_regex LIBS += -lgsl -lgslcblas -lfftw3 -lboost_system -lboost_filesystem -lboost_regex
# here is workaround since JCNS /usr/local doesn't have shared fftw3 # here is workaround since JCNS /usr/local doesn't have shared fftw3
#LIBS += -lgsl -lgslcblas -lboost_system -lboost_filesystem -lboost_regex # qmake CONFIG+=JCNS
#macx { CONFIG(JCNS) {
# LIBS += -lfftw3 LIBS -= -lfftw3
#} LIBS += -Bstatic -lfftw3f -Bdynamic # request for static (with fPIC option)
#!macx:unix { # "-lfftw3f" - with fPIC option, "-lfftw3" - without fPIC option
# # telling linker to link with static version of the library with fPIC option }
# LIBS += -Bstatic -lfftw3f -Bdynamic
#}
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
......
...@@ -24,5 +24,5 @@ make ...@@ -24,5 +24,5 @@ make
3) run profiling 3) run profiling
run_gperftools.sh run_gperftools.sh
*) When compiled with GPERFTOOLS option, profiling with valgrind (callgrind) wont work.
...@@ -5,7 +5,7 @@ mkdir -p ./output ...@@ -5,7 +5,7 @@ mkdir -p ./output
application=../../App/App application=../../App/App
arguments="isgisaxs9 batch" arguments="isgisaxs9 profile"
focuson=GISASExperiment focuson=GISASExperiment
# ------------------------------------------- # # ------------------------------------------- #
......
...@@ -6,7 +6,7 @@ mkdir -p ./output ...@@ -6,7 +6,7 @@ mkdir -p ./output
application=../../App/App application=../../App/App
#arguments="isgisaxs9" #arguments="isgisaxs9"
arguments="isgisaxs9 batch" arguments="isgisaxs9 profile"
focuson=GISASExperiment focuson=GISASExperiment
# ------------------------------------------- # # ------------------------------------------- #
...@@ -16,7 +16,7 @@ profile_cpu=yes ...@@ -16,7 +16,7 @@ profile_cpu=yes
if [ $profile_cpu = "yes" ] if [ $profile_cpu = "yes" ]
then then
# valgrind --tool=callgrind -v --dump-every-bb=10000000 --dump-instr=yes --trace-jump=yes ./App commandline # valgrind --tool=callgrind -v --dump-every-bb=10000000 --dump-instr=yes --trace-jump=yes ./App commandline
valgrind --tool=callgrind --callgrind-out-file=./output/callgrind.output --log-file=./output/valgrind2.output --dump-instr=yes --trace-jump=yes $application $arguments valgrind --tool=callgrind --dsymutil=yes --callgrind-out-file=./output/callgrind.output --log-file=./output/tmplog.output --dump-instr=yes --trace-jump=yes $application $arguments
# --zero-before=GISASExperiment # --zero-before=GISASExperiment
fi fi
...@@ -27,7 +27,7 @@ fi ...@@ -27,7 +27,7 @@ fi
profile_memory=yes profile_memory=yes
if [ $profile_memory = "yes" ] if [ $profile_memory = "yes" ]
then then
valgrind --log-file=./output/valgrind.output --num-callers=6 --track-origins=yes --leak-check=yes $application $arguments valgrind --log-file=./output/valgrind.output --dsymutil=yes --num-callers=6 --track-origins=yes --leak-check=yes $application $arguments
fi fi
README 0 → 100644
This is the GISASFW framework.
-------------------------------------------------------------------------------
Package content:
-------------------------------------------------------------------------------
./Core - the main library of the framework
./App - functional tests
./ThirdParty - third party libraries
./UnitTests - collection of cpp unit tests
./Examples - usage examples
./Doc - documentation
-------------------------------------------------------------------------------
Installation Instructions
-------------------------------------------------------------------------------
> Installation in lucky case
~ cd <to_the_package_directory>
~ qmake; make
* 'make clean', and more powerfull 'make distclean' are also available
> Installation of additional libraries might be required before
* gsl fftw3 boost(>1.46) - these are dependencies of Core
* ROOT - these are dependencies of App
* probably also python>=2.6 and Qt>=4.5
* (see explanation about 'root' below)
> Checked on following platforms
* MacOS 10.7.3
* OpenSuse 12.1
* CentOS 5.1 with JCNS setup (see issue below)
> Issue with CentOS from JCNS
* it has /usr/local with lot of officially installed libraries
* however
* fftw3 in /usr/local compiled only statically
As a temporary workaround GISASFW package should be compiled with
qmake CONFIG+=JCNS; make
* boost 1.46 which is there, is buggy too
As a temporary workaround you have to define environment variable
export LC_ALL=C
for more information see https://svn.boost.org/trac/boost/ticket/5928 or google for
"locale::facet::_S_create_c_locale name not valid"
-------------------------------------------------------------------------------
Installation Instructions +
-------------------------------------------------------------------------------
> Words about ROOT.
ROOT is extremely powerfull, awfully professional and exceptionally supported,
C++ based analysis framework, see http://root.cern.ch.
Framework has to be installed to be able to compile App part (containing functional tests). You do not need to install
ROOT to have only Core library.
> How to install ROOT
* different ways are explained on site
* one possible way is following
*
* download source from http://root.cern.ch, unpack it somewhere
* define variable pointing to the directory where ROOT will be installed
export ROOTSYS=/home/jamesbond/software/root
* go to the directory where you unpacked ROOT and run
./configure; make; make install
> Steps after installation
* ROOT requires couple of system variables to be defined
* the easiest way to do it is to run
source /home/jamesbond/software/root/bin/thisroot.sh
each time you are going to use ROOT
* simply put this call in your .bash_profile
* or you can just define variables by yourself
export ROOTSYS=/home/jamesbond/software/root
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment