Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywel Carver committed Dec 23, 2011
2 parents e7a004b + b6ad325 commit 6236f6b
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 37 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ option(HEMELB_USE_ALL_WARNINGS_GNU "Show all compiler warnings on development bu
option(HEMELB_USE_BOOST "Use Boost" OFF)
set(HEMELB_OPTIMISATION "-O4" CACHE STRING "Optimisation level (can be blank or -O1 to -O4)")
set(HEMELB_STEERING_HOST "CCS" CACHE STRING "Use a default host suffix for steering? (CCS, NGS2Leeds, NGS2Manchester, LONI, NCSA or blank)")

option(HEMELB_DEPENDENCIES_SET_RPATH "Set runtime RPATH" ON)
#------- Dependencies -----------

add_subdirectory(dependencies)
Expand Down Expand Up @@ -52,6 +52,9 @@ ExternalProject_Add(
-DHEMELB_USE_ALL_WARNINGS_GNU=${HEMELB_USE_ALL_WARNINGS_GNU}
-DHEMELB_USE_BOOST=${HEMELB_USE_BOOST}
-DHEMELB_STEERING_HOST=${HEMELB_STEERING_HOST}
-DCTEMPLATE_USE_STATIC=${CTEMPLATE_USE_STATIC}
-DCPPUNIT_USE_STATIC=${CPPUNIT_USE_STATIC}
-DHEMELB_DEPENDENCIES_SET_RPATH=${HEMELB_DEPENDENCIES_SET_RPATH}
)
ExternalProject_Get_Property(hemelb install_dir)

Expand Down
12 changes: 8 additions & 4 deletions Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ option(HEMELB_BUILD_UNITTESTS "Build the unit-tests" ON)
option(HEMELB_USE_ALL_WARNINGS_GNU "Show all compiler warnings on development builds (gnu-style-compilers)" ON)
option(HEMELB_USE_STREAKLINES "Calculate streakline images" ON)
option(HEMELB_USE_BOOST "Use Boost" OFF)
option(HEMELB_DEPENDENCIES_SET_RPATH "Set runtime RPATH" ON)

set(HEMELB_LOG_LEVEL info
CACHE STRING "Log level, choose 'debug', 'warning', or 'info'" )
set(HEMELB_STEERING_LIB basic
Expand Down Expand Up @@ -42,9 +44,10 @@ list(APPEND CMAKE_INCLUDE_PATH ${HEMELB_DEPENDENCIES_INSTALL_PATH}/include)
list(APPEND CMAKE_LIBRARY_PATH ${HEMELB_DEPENDENCIES_INSTALL_PATH}/lib)

#--- Set up runtime search path for DLLs -----

SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_RPATH "${HEMELB_DEPENDENCIES_PATH}/lib")
if(HEMELB_DEPENDENCIES_SET_RPATH)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_RPATH "${HEMELB_DEPENDENCIES_PATH}/lib")
endif()

#-------Check for platform dependent features ----

Expand Down Expand Up @@ -162,7 +165,8 @@ if(HEMELB_BUILD_UNITTESTS)
${TINYXML_LIBRARIES}
${CPPUNIT_LIBRARY}
${Boost_LIBRARIES}
${CTEMPLATE_LIBRARIES})
${CTEMPLATE_LIBRARIES}
${CMAKE_DL_LIBS}) #Because on some systems CPPUNIT needs to be linked to libdl
INSTALL(TARGETS unittests_hemelb RUNTIME DESTINATION bin)
list(APPEND RESOURCES unittests/resources/four_cube.dat unittests/resources/four_cube.xml unittests/resources/config.xml)
endif()
Expand Down
8 changes: 4 additions & 4 deletions Code/geometry/LatticeData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,17 @@ namespace hemelb
// This is used in Calculate BC in IO.
SetSiteData(site_map, iSiteDataForThisRank[lSiteIndexOnProc]);

if (GetCollisionType(GetSiteData(site_map)) & (EDGE|INLET|OUTLET))
if (GetCollisionType(GetSiteData(site_map)) & EDGE)
{
SetWallNormal(site_map, GetBlock(n)->wall_data[m].wall_nor);
SetWallDistance(site_map, GetBlock(n)->wall_data[m].cut_dist);
}
else
{
double lBigDistance[14];
for (unsigned int ii = 0; ii < 14; ii++)
double lBigDistance[3];
for (unsigned int ii = 0; ii < 3; ii++)
lBigDistance[ii] = NO_VALUE;
SetWallDistance(site_map, lBigDistance);
//SetWallDistance(site_map, lBigDistance);
SetWallNormal(site_map, lBigDistance);
}
++lSiteIndexOnProc;
Expand Down
1 change: 1 addition & 0 deletions Code/net/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vector>
#include <map>
#include <cstdlib>
#include <iostream>

#include "constants.h"
#include "mpiInclude.h"
Expand Down
2 changes: 0 additions & 2 deletions Code/unittests/SimulationMasterTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ namespace hemelb
CopyResourceToTempdir("four_cube.xml");
CopyResourceToTempdir("four_cube.dat");
options = new hemelb::configuration::CommandLine(argc, argv);
hemelb::debug::Debugger::Init(argv[0]);

master = new SimulationMaster(*options);
}

Expand Down
9 changes: 7 additions & 2 deletions Code/unittests/geometry/GeometryReaderTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cppunit/TestFixture.h>
#include "resources/Resource.h"
#include "unittests/FourCubeLatticeData.h"
#include "unittests/helpers/FolderTestFixture.h"
namespace hemelb
{
namespace unittests
Expand All @@ -27,7 +28,7 @@ namespace hemelb

typedef LatticeData::GlobalLatticeData TestableGlobalLatticeData;
};
class GeometryReaderTests : public CppUnit::TestFixture
class GeometryReaderTests : public FolderTestFixture
{
CPPUNIT_TEST_SUITE( GeometryReaderTests);
CPPUNIT_TEST( TestRead);
Expand All @@ -40,11 +41,15 @@ namespace hemelb
bool dummy;
topology::NetworkTopology::Instance()->Init(0, NULL, &dummy);
fourCube = FourCubeLatticeData::CubeGlobalLatticeData::Create();
simConfig = configuration::SimConfig::Load(Resource("four_cube.xml").Path().c_str());
FolderTestFixture::setUp();
CopyResourceToTempdir("four_cube.xml");
CopyResourceToTempdir("four_cube.dat");
simConfig = configuration::SimConfig::Load("four_cube.xml");
}

void tearDown()
{
FolderTestFixture::tearDown();
delete reader;
delete globalLattice;
delete fourCube;
Expand Down
5 changes: 3 additions & 2 deletions Code/unittests/lbtests/StreamerTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ namespace hemelb
CPPUNIT_ASSERT_MESSAGE("Expected to find a boundary"
"opposite an unstreamed-to direction "+message.str(),
latDat->HasBoundary(streamedToSite, oppDirection));
CPPUNIT_ASSERT_MESSAGE("Expect defined cut distance opposite an unstreamed-to direction "+message.str(),
latDat->GetCutDistance(streamedToSite, oppDirection)!=NO_VALUE);
// Test disabled due to RegressionTests issue, see discussion in #87
//CPPUNIT_ASSERT_MESSAGE("Expect defined cut distance opposite an unstreamed-to direction "+message.str(),
// latDat->GetCutDistance(streamedToSite, oppDirection)!=NO_VALUE);

// To verify the operation of the f-interpolation boundary condition, we'll need:
// - the distance to the wall * 2
Expand Down
4 changes: 2 additions & 2 deletions Code/unittests/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/TextTestProgressListener.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/extensions/HelperMacros.h>
#include <stdexcept>
#include "unittests/lbtests/lbtests.h"
Expand Down Expand Up @@ -39,7 +39,7 @@ int main(int argc, char **argv)
controller.addListener(&result);

// Add a listener that print dots to stdout as test run.
CppUnit::TextTestProgressListener progress;
CppUnit::BriefTestProgressListener progress;
controller.addListener(&progress);

// Add the top suite to the test runner
Expand Down
17 changes: 11 additions & 6 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ find_package(TinyXML QUIET)
if (TINYXML_FOUND)
message("TinyXML already installed, no need to download")
else()
message("TinyXML not installed, will download and build")
message("TinyXML not installed, wil build from source")
OPTION(TIXML_USE_STL "Use STL with TIXML" ON)
if(TIXML_USE_STL)
add_definitions(-DTIXML_USE_STL)
Expand All @@ -22,6 +22,7 @@ else()
PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions
)
if(NOT TINYXML_TARBALL)
message("No tinyxml source found, will download.")
set(TINYXML_TARBALL http://sourceforge.net/projects/tinyxml/files/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz
CACHE STRING "Path to download TinyXML (can be local file://)" FORCE)
endif()
Expand All @@ -33,7 +34,7 @@ else()
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DTIXML_USE_STL=${TIXML_USE_STL}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_FLAGS_RELEASE=-O4
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
PATCH_COMMAND cp ${HEMELB_DEPENDENCIES_PATH}/patches/tinyxml.cmake CMakeLists.txt
)
endif()
Expand All @@ -43,12 +44,13 @@ find_package(Parmetis QUIET)
if (PARMETIS_FOUND)
message("Parmetis already installed, no need to download")
else()
message("Parmetis not installed, will download and build")
message("Parmetis not installed, will build from source")
find_file(PARMETIS_TARBALL parmetis-4.0.2.tar.gz
DOC "Path to download Parmetis (can be url http://)"
PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions
)
if(NOT PARMETIS_TARBALL)
message("No parmetis source found, will download.")
set(PARMETIS_TARBALL http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.2.tar.gz
CACHE STRING "Path to download Parmetis (can be local file://)" FORCE)
endif()
Expand Down Expand Up @@ -78,12 +80,13 @@ find_package(CPPUnit QUIET)
if (CPPUNIT_FOUND)
message("CPPUnit already installed, no need to download")
else()
message("CPPUnit not installed, will download and build")
message("CPPUnit not installed, will build from source")
find_file(CPPUNIT_TARBALL cppunit-1.12.1.tar.gz
DOC "Path to download CPPUNIT (can be url http://)"
PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions
)
if(NOT CPPUNIT_TARBALL)
message("No cppunit source found, will download.")
set(CPPUNIT_TARBALL http://downloads.sourceforge.net/cppunit/cppunit-1.12.1.tar.gz
CACHE STRING "Path to download CPPUNIT (can be local file://)" FORCE)
endif()
Expand Down Expand Up @@ -120,12 +123,13 @@ if(HEMELB_USE_BOOST)
if (BOOST_FOUND)
message("Boost 1.48 already installed, no need to download")
else()
message("Bost not installed, will download and build")
message("Boost not installed, will build from source")
find_file(BOOST_TARBALL boost_1_48_0.tar.gz
DOC "Path to download BOOST (can be url http://)"
PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions
)
if(NOT BOOST_TARBALL)
message("No boost source found, will download.")
set(BOOST_TARBALL http://sourceforge.net/projects/boost/files/boost/1.48.0/boost_1_48_0.tar.gz
CACHE STRING "Path to download BOOST (can be local file://)" FORCE)
endif()
Expand Down Expand Up @@ -153,12 +157,13 @@ find_package(CTemplate)
if (CTEMPLATE_FOUND)
message("Ctemplate already installed, no need to download")
else()
message("Ctemplate not installed, will download and build")
message("Ctemplate not installed, will build from source")
find_file(CTEMPLATE_TARBALL ctemplate-1.0.tar.gz
DOC "Path to download CTemplate (can be url http://)"
PATHS ${HEMELB_DEPENDENCIES_PATH}/distributions
)
if(NOT CTEMPLATE_TARBALL)
message("No ctemplate source found, will download.")
set(CTEMPLATE_TARBALL http://google-ctemplate.googlecode.com/files/ctemplate-1.0.tar.gz
CACHE STRING "Path to download CTemplate (can be local file://)" FORCE)
endif()
Expand Down
8 changes: 8 additions & 0 deletions dependencies/Modules/FindCPPUnit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
# CPPUNIT_LIBRARY - The CppUnit library to link against.

FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/Test.h)
option(CPPUNIT_USE_STATIC "Prefer Static CPPUNIT library" OFF)
if(CPPUNIT_USE_STATIC)
set(__old_cmake_find_lib_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
FIND_LIBRARY(CPPUNIT_LIBRARY NAMES cppunit)
if(CPPUNIT_USE_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${__old_cmake_find_lib_suffixes})
endif()

IF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARY)
SET(CPPUNIT_FOUND TRUE)
Expand Down
9 changes: 9 additions & 0 deletions dependencies/Modules/FindCTemplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@
# CTEMPLATE_LIBRARIES - List of libraries when using CTEMPLATE.
#

option(CTEMPLATE_USE_STATIC "Prefer Static CTemplate library" OFF)
IF( CTEMPLATE_INCLUDE_DIR )
# Already in cache, be silent
SET( CTEMPLATE_FIND_QUIETLY TRUE )
ENDIF( CTEMPLATE_INCLUDE_DIR )

FIND_PATH( CTEMPLATE_INCLUDE_DIR "ctemplate/template.h")
if(CTEMPLATE_USE_STATIC)
set(__old_cmake_find_lib_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()

FIND_LIBRARY( CTEMPLATE_LIBRARIES
NAMES "ctemplate"
PATH_SUFFIXES "ctemplate" )

if(CTEMPLATE_USE_STATIC)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${__old_cmake_find_lib_suffixes})
endif()

# handle the QUIETLY and REQUIRED arguments and set CTEMPLATE_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE( "FindPackageHandleStandardArgs" )
Expand Down
30 changes: 22 additions & 8 deletions deploy/fab.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,18 @@
def clone():
"""Delete and checkout the repository afresh."""
run(template("mkdir -p $remote_path"))
with cd(env.remote_path):
run(template("rm -rf $repository"))
run(template("hg clone $hg/$repository"))
if env.no_ssh:
with cd(env.remote_path):
run(template("rm -rf $repository"))
# Some machines do not allow outgoing connections back to the mercurial server
# so the data must be sent by a project sync instead.
execute(sync)
# On such machines, we cannot rely on an outgoing connection to servers to find dependencies either.
execute(send_distributions)
else:
with cd(env.remote_path):
run(template("rm -rf $repository"))
run(template("hg clone $hg/$repository"))

@task(alias='cold')
def deploy_cold():
Expand All @@ -51,13 +60,17 @@ def update_build():
def require_recopy():
"""Notify the build system that the code has changed."""
run(template("touch $build_path/hemelb-prefix/src/hemelb-stamp/hemelb-mkdir"))
run(template("rm -rf $build_path/hemelb-prefix"))

@task
def update():
"""Update the remote mercurial repository"""
with cd(env.repository_path):
run("hg pull")
run("hg update")
if env.no_ssh:
execute(sync)
else:
with cd(env.repository_path):
run("hg pull")
run("hg update")

@task
def prepare_paths():
Expand Down Expand Up @@ -146,8 +159,9 @@ def send_distributions():
Useful to prepare a build on target machines with CMake before 2.8.4, where
HTTP redirects are not followed.
"""
put(os.path.join(env.localroot,'dependencies','distributions','*.tar.gz'),
env.pather.join(env.repository_path,'dependencies','distributions'))
run(template("mkdir -p $repository_path/dependencies/distributions"))
rsync_project(local_dir=os.path.join(env.localroot,'dependencies','distributions')+'/',
remote_dir=env.pather.join(env.repository_path,'dependencies','distributions'))

@task
def sync():
Expand Down
6 changes: 3 additions & 3 deletions deploy/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#Root of local HemeLB checkout.
env.localroot=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

env.no_ssh=False
#Load and invoke the default non-machine specific config JSON dictionaries.
config=yaml.load(open(os.path.join(env.localroot,'deploy','machines.yml')))
env.update(config['default'])
Expand Down Expand Up @@ -92,8 +92,8 @@ def complete_environment():
module_commands=["module %s"%module for module in env.modules]
env.build_prefix=" && ".join(module_commands+env.build_prefix_commands) or 'echo Building...'

env.run_prefix_commands.append(template("export PYTHONPATH=$$PYTHONPATH:$tools_build_path"))
env.run_prefix=" && ".join(module_commands+env.run_prefix_commands) or 'echo Running...'
env.run_prefix_commands.append("export PYTHONPATH=$$PYTHONPATH:$tools_build_path")
env.run_prefix=" && ".join(module_commands+map(template,env.run_prefix_commands)) or 'echo Running...'

#env.build_number=subprocess.check_output(['hg','id','-i','-rtip','%s/%s'%(env.hg,env.repository)]).strip()
# check_output is 2.7 python and later only. Revert to oldfashioned popen.
Expand Down
8 changes: 6 additions & 2 deletions deploy/machines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ entropy:
tools_build: "lib.linux-x86_64-2.6"
results_path_template: "/store4/blood/$username/FabricHemeLb/results"
config_path_template: "/store4/blood/$username/FabricHemeLb/config_files"
hector:
hector:
no_ssh: true # Hector doesn't allow outgoing ssh sessions.
remote: "login.hector.ac.uk"
remote_path_template: "/home/e10/e10/$username/FabricHemeLb"
results_path_template: "/work/e10/e10/$username/FabricHemeLb/results"
config_path_template: "/work/e10/e10/$username/FabricHemeLb/config_files"
modules: ["load CMake/2.8.6"]
build_prefix_commands: ["export CXX=CC","export CC=cc", "export LD=CC"] #Tell autoconf for dependencies where the hector compilers are
tools_build: "TODO"
cmake_options:
HEMELB_USE_ALL_WARNINGS_GNU: "OFF"
CMAKE_CXX_COMPILER: "CC"
CMAKE_C_COMPILER: "cc"
HEMELB_OPTIMISATION: "-O3"
CMAKE_CXX_FLAGS_RELEASE: "-O3"
HEMELB_OPTIMISATION: "-O3"
HEMELB_DEPENDENCIES_SET_RPATH: "OFF"
2 changes: 1 addition & 1 deletion deploy/templates/legion-unittests
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@

#load modules
$run_prefix

export TMP=$job_results
#and run
mpirun -machinefile $$TMPDIR/machines -np $$NSLOTS $install_path/bin/unittests_hemelb -o 'tests.xml'

0 comments on commit 6236f6b

Please sign in to comment.