mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-15 22:21:28 +05:00
Disabling parallel compute for windows
This commit is contained in:
parent
62ca7cff07
commit
3fb90fec5e
@ -27,8 +27,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//#define CHRONODEF
|
//#define CHRONODEF
|
||||||
|
//
|
||||||
|
#ifndef WIN32
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#endif
|
||||||
#include "SMESH_Gen.hxx"
|
#include "SMESH_Gen.hxx"
|
||||||
|
|
||||||
#include "SMESH_DriverMesh.hxx"
|
#include "SMESH_DriverMesh.hxx"
|
||||||
@ -348,9 +350,15 @@ bool SMESH_Gen::parallelComputeSubMeshes(
|
|||||||
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#ifdef WIN32
|
||||||
|
compute_function(smToCompute, computeEvent,
|
||||||
|
shapeSM, aShapeOnly, allowedSubShapes,
|
||||||
|
aShapesId);
|
||||||
|
#else
|
||||||
boost::asio::post(*(aMesh._pool), std::bind(compute_function, smToCompute, computeEvent,
|
boost::asio::post(*(aMesh._pool), std::bind(compute_function, smToCompute, computeEvent,
|
||||||
shapeSM, aShapeOnly, allowedSubShapes,
|
shapeSM, aShapeOnly, allowedSubShapes,
|
||||||
aShapesId));
|
aShapesId));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waiting for the thread for Solids to finish
|
// Waiting for the thread for Solids to finish
|
||||||
@ -361,7 +369,6 @@ bool SMESH_Gen::parallelComputeSubMeshes(
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*
|
/*
|
||||||
* Compute a mesh
|
* Compute a mesh
|
||||||
|
@ -239,9 +239,10 @@ SMESH_Mesh::~SMESH_Mesh()
|
|||||||
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_meshDS);
|
int result=pthread_create(&thread, NULL, deleteMeshDS, (void*)_meshDS);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef WIN32
|
||||||
if(_pool)
|
if(_pool)
|
||||||
DeletePoolThreads();
|
DeletePoolThreads();
|
||||||
|
#endif
|
||||||
#ifndef _DEBUG_
|
#ifndef _DEBUG_
|
||||||
fs::remove_all(tmp_folder);
|
fs::remove_all(tmp_folder);
|
||||||
#endif
|
#endif
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "SMESH_SMESH.hxx"
|
#include "SMESH_SMESH.hxx"
|
||||||
|
|
||||||
|
|
||||||
#include "SMDSAbs_ElementType.hxx"
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
#include "SMESH_ComputeError.hxx"
|
#include "SMESH_ComputeError.hxx"
|
||||||
#include "SMESH_Controls.hxx"
|
#include "SMESH_Controls.hxx"
|
||||||
@ -49,8 +50,10 @@
|
|||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#ifndef WIN32
|
||||||
#include <boost/asio/thread_pool.hpp>
|
#include <boost/asio/thread_pool.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#pragma warning(disable:4251) // Warning DLL Interface ...
|
#pragma warning(disable:4251) // Warning DLL Interface ...
|
||||||
@ -388,6 +391,19 @@ class SMESH_EXPORT SMESH_Mesh
|
|||||||
|
|
||||||
// Parallel computation functions
|
// Parallel computation functions
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
void Lock() {};
|
||||||
|
void Unlock() {};
|
||||||
|
|
||||||
|
int GetNbThreads(){return _NbThreads;};
|
||||||
|
void SetNbThreads(int nbThreads){std::cout << "Warning Parallel Meshing is disabled on Windows it will behave as a slower normal compute" << std::endl;_NbThreads=nbThreads;};
|
||||||
|
|
||||||
|
void InitPoolThreads(){};
|
||||||
|
void DeletePoolThreads(){};
|
||||||
|
void wait(){}
|
||||||
|
|
||||||
|
bool IsParallel(){return _NbThreads > 0;}
|
||||||
|
#else
|
||||||
void Lock() {_my_lock.lock();};
|
void Lock() {_my_lock.lock();};
|
||||||
void Unlock() {_my_lock.unlock();};
|
void Unlock() {_my_lock.unlock();};
|
||||||
|
|
||||||
@ -400,10 +416,13 @@ class SMESH_EXPORT SMESH_Mesh
|
|||||||
void wait(){_pool->join(); DeletePoolThreads(); InitPoolThreads(); }
|
void wait(){_pool->join(); DeletePoolThreads(); InitPoolThreads(); }
|
||||||
|
|
||||||
bool IsParallel(){return _NbThreads > 0;}
|
bool IsParallel(){return _NbThreads > 0;}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Temporary folder used during parallel Computation
|
// Temporary folder used during parallel Computation
|
||||||
boost::filesystem::path tmp_folder;
|
boost::filesystem::path tmp_folder;
|
||||||
|
#ifndef WIN32
|
||||||
boost::asio::thread_pool * _pool = nullptr; //thread pool for computation
|
boost::asio::thread_pool * _pool = nullptr; //thread pool for computation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -453,7 +472,9 @@ protected:
|
|||||||
TCallUp* _callUp;
|
TCallUp* _callUp;
|
||||||
|
|
||||||
// Mutex for multhitreading write in SMESH_Mesh
|
// Mutex for multhitreading write in SMESH_Mesh
|
||||||
|
#ifndef WIN32
|
||||||
boost::mutex _my_lock;
|
boost::mutex _my_lock;
|
||||||
|
#endif
|
||||||
int _NbThreads=0;
|
int _NbThreads=0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user