cmake_minimum_required(VERSION 2.8)
-find_package(Boost 1.49 COMPONENTS iostreams REQUIRED)
+find_package(Boost 1.49 COMPONENTS filesystem iostreams REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_library(lat_configcache configcache.cpp)
add_library(lat_neigh neigh.cpp)
add_library(lat_writeout writeout.cpp)
+target_link_libraries(lat_writeout ${Boost_LIBRARIES})
add_library(lat_paraq paraq.cpp)
#include <errno.h>
#include <unistd.h>
+#include <boost/filesystem.hpp>
+
using namespace std;
string writeout::tstamp(const long& timestamp)
sprintf(cRank, "%d", rank);
fulldir = wdir + "/" + tstamp(timestamp) + "_" + signature + ".tmp";
- mkdir(fulldir.c_str(), 0775);
+ if (rank==0)
+ mkdir(fulldir.c_str(), 0775);
+ else {
+ while ( ! ( boost::filesystem::exists(fulldir) && boost::filesystem::is_directory(fulldir) ) ) {
+ cerr << "WRITOUT: Waiting for rank 0 to create out directory." << endl << flush;
+ sleep(1);
+ }
+ }
logf.open( (fulldir + "/rank" + cRank + ".log").c_str() );