+ created new eoParallel class with a global variable eo::parallel in order to store all parameters tied to parallelization and to access from anywhere
This commit is contained in:
parent
40817a0931
commit
63d28c1c79
2 changed files with 132 additions and 0 deletions
55
eo/src/utils/eoParallel.cpp
Normal file
55
eo/src/utils/eoParallel.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
/*
|
||||
|
||||
(c) Thales group, 2010
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation;
|
||||
version 2 of the license.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Contact: http://eodev.sourceforge.net
|
||||
|
||||
Authors:
|
||||
Caner Candan <caner.candan@thalesgroup.com>
|
||||
|
||||
*/
|
||||
|
||||
#include "eoParallel.h"
|
||||
|
||||
eoParallel::eoParallel()
|
||||
: _isEnabled( false, "parallelize-loop", "Enable memory shared parallelization into evaluation's loops", '\0' ),
|
||||
_isDynamic( false, "parallelize-dynamic", "Enable dynamic memory shared parallelization", '\0' ),
|
||||
_prefix( "results", "parallelize-prefix", "Enable dynamic memory shared parallelization", '\0' )
|
||||
{}
|
||||
|
||||
std::string eoParallel::className() const
|
||||
{
|
||||
return "eoParallel";
|
||||
}
|
||||
|
||||
void eoParallel::_createParameters( eoParser& parser )
|
||||
{
|
||||
std::string section("Parallelization");
|
||||
|
||||
parser.processParam( _isEnabled, section );
|
||||
parser.processParam( _isDynamic, section );
|
||||
parser.processParam( _prefix, section );
|
||||
}
|
||||
|
||||
void make_parallel(eoParser& parser)
|
||||
{
|
||||
eo::parallel._createParameters( parser );
|
||||
}
|
||||
|
||||
eoParallel eo::parallel;
|
||||
77
eo/src/utils/eoParallel.h
Normal file
77
eo/src/utils/eoParallel.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
/*
|
||||
(c) Thales group, 2010
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation;
|
||||
version 2 of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Contact: http://eodev.sourceforge.net
|
||||
|
||||
Authors:
|
||||
Caner Candan <caner.candan@thalesgroup.com>
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup Parallel Parallel
|
||||
* @ingroup Utilities
|
||||
@{
|
||||
*/
|
||||
|
||||
#ifndef eoParallel_h
|
||||
#define eoParallel_h
|
||||
|
||||
#include "eoObject.h"
|
||||
#include "eoParser.h"
|
||||
|
||||
/**
|
||||
* eoParallel
|
||||
* Class providing parameters for parallelization
|
||||
* Use of a global variable eo::parallel to easily use the parallelization parameters anywhere
|
||||
*/
|
||||
class eoParallel : public eoObject
|
||||
{
|
||||
public:
|
||||
eoParallel();
|
||||
|
||||
virtual std::string className() const;
|
||||
|
||||
inline bool isEnabled() { return _isEnabled.value(); }
|
||||
inline bool isDynamic() { return _isDynamic.value(); }
|
||||
inline std::string prefix() { return _prefix.value(); }
|
||||
|
||||
friend void make_parallel(eoParser&);
|
||||
|
||||
private:
|
||||
void _createParameters( eoParser& );
|
||||
|
||||
private:
|
||||
eoValueParam<bool> _isEnabled;
|
||||
eoValueParam<bool> _isDynamic;
|
||||
eoValueParam<std::string> _prefix;
|
||||
};
|
||||
|
||||
void make_parallel(eoParser&);
|
||||
|
||||
namespace eo
|
||||
{
|
||||
/**
|
||||
* parallel is an external global variable defined in order to use where ever you want the parallel parameters
|
||||
*/
|
||||
extern eoParallel parallel;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif // !eoParallel_h
|
||||
Loading…
Add table
Add a link
Reference in a new issue