diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bbae92..3903228 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,8 @@ # cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -project(Brion VERSION 1.9.0) -set(Brion_VERSION_ABI 7) +project(Brion VERSION 1.10.0) +set(Brion_VERSION_ABI 8) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake ${CMAKE_SOURCE_DIR}/CMake/common ${CMAKE_SOURCE_DIR}/Pydoxine/CMake) diff --git a/brain/circuit.cpp b/brain/circuit.cpp index 75f3a14..b646c50 100644 --- a/brain/circuit.cpp +++ b/brain/circuit.cpp @@ -90,6 +90,9 @@ neuron::Morphologies Circuit::loadMorphologies( const GIDSet& gids, const Coordinates coords ) const { const URIs& uris = getMorphologyURIs( gids ); + const auto circuitPath = + // cache outside of loop, canonical does stat() which is slow on GPFS + fs::canonical( _impl->getCircuitSource().getPath( )).generic_string(); // < GID, hash > Strings gidHashes; @@ -98,19 +101,15 @@ neuron::Morphologies Circuit::loadMorphologies( const GIDSet& gids, GIDSet::const_iterator gid = gids.begin(); for( size_t i = 0; i < uris.size(); ++i, ++gid ) { - std::string hash( fs::canonical( uris[i].getPath( )).generic_string( )); + auto hash = uris[i].getPath(); + if( hash[0] != '/' ) // opt: don't stat abs file path (see above) + hash = fs::canonical( hash ).generic_string(); if( coords == Coordinates::global ) - { // store circuit + GID for transformed morphology - hash += fs::canonical( - _impl->getCircuitSource().getPath( )).generic_string() + - boost::lexical_cast< std::string >( *gid ); - hash = servus::make_uint128( hash ).getString(); - } - else - hash = servus::make_uint128( hash ).getString(); + hash += circuitPath + boost::lexical_cast< std::string >( *gid ); + hash = servus::make_uint128( hash ).getString(); gidHashes.push_back( hash ); hashes.insert( hash ); } diff --git a/brion/circuit.cpp b/brion/circuit.cpp index 911c4df..5654c41 100644 --- a/brion/circuit.cpp +++ b/brion/circuit.cpp @@ -24,8 +24,8 @@ #include #include #include -#include #include +#include namespace brion { @@ -55,7 +55,7 @@ class Circuit::Impl LBTHROW( std::runtime_error( "Expecting mvd file format for " " circuit file " + source )); - typedef stde::hash_map< std::string, Section > LookUp; + typedef std::unordered_map< std::string, Section > LookUp; LookUp sections; sections.insert( std::make_pair( "Neurons Loaded", SECTION_NEURONS )); sections.insert( std::make_pair( "MicroBox Data", SECTION_MICROBOX )); @@ -202,7 +202,7 @@ class Circuit::Impl private: std::ifstream _file; - typedef stde::hash_map< uint32_t, Strings > CircuitTable; + typedef std::unordered_map< uint32_t, Strings > CircuitTable; CircuitTable _table; }; diff --git a/doc/Changelog.md b/doc/Changelog.md index 7a024be..6d77dc9 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -1,6 +1,12 @@ Changelog {#Changelog} ========= +# git master + +* [119](https://github.com/BlueBrain/Brion/pull/119): + Optimized brain::Circuit::loadMorphologies for slow stat'ing + filesystems (GPFS) + # Release 1.9.0 (09-Dec-2016) * [117](https://github.com/BlueBrain/Brion/pull/117):