Commit 46ecd386 authored by Matthieu Dorier's avatar Matthieu Dorier

added init/finalization

parent 7d1be819
......@@ -12,7 +12,7 @@ void hello() {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::abt scope;
std::vector<tl::managed<tl::xstream>> ess;
......
......@@ -12,7 +12,7 @@ void hello() {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::abt scope;
std::vector<tl::managed<tl::xstream>> ess;
......@@ -36,5 +36,6 @@ int main(int argc, char** argv) {
for(int i=0; i < 4; i++) {
ess[i]->join();
}
return 0;
}
......@@ -12,7 +12,7 @@ void hello() {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::abt scope;
std::vector<tl::managed<tl::xstream>> ess;
......
......@@ -19,7 +19,7 @@ void hello(tl::mutex& mtx) {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::abt scope;
std::vector<tl::managed<tl::xstream>> ess;
......
......@@ -147,7 +147,7 @@ void hello() {
int main(int argc, char** argv) {
tl::engine myEngine("tcp", THALLIUM_CLIENT_MODE);
tl::abt scope;
// create pools
std::vector<tl::managed<tl::pool>> pools;
......
......@@ -2,6 +2,7 @@
#define __THALLIUM_HPP
#include <margo.h>
#include <thallium/abt.hpp>
#include <thallium/bulk_mode.hpp>
#include <thallium/bulk.hpp>
#include <thallium/engine.hpp>
......
/*
* Copyright (c) 2017 UChicago Argonne, LLC
*
* See COPYRIGHT in top-level directory.
*/
#ifndef __THALLIUM_ABT_HPP
#define __THALLIUM_ABT_HPP
#include <thallium/exception.hpp>
#include <thallium/abt_errors.hpp>
namespace thallium {
/**
* Exception class thrown by the abt class.
*/
class abt_exception : public exception {
public:
template<typename ... Args>
abt_exception(Args&&... args)
: exception(std::forward<Args>(args)...) {}
};
#define TL_ABT_EXCEPTION(__fun,__ret) \
abt_exception(#__fun," returned ", abt_error_get_name(__ret),\
" (", abt_error_get_description(__ret),") in ",__FILE__,":",__LINE__)
#define TL_ABT_ASSERT(__call) {\
int __ret = __call; \
if(__ret != ABT_SUCCESS) {\
throw TL_ABT_EXCEPTION(__call, __ret);\
}\
}
class abt {
public:
abt() {
initialize();
}
~abt() {
finalize();
}
/**
* @brief Initialize the Argobots execution environment.
*/
static void initialize() {
TL_ABT_ASSERT(ABT_init(0, nullptr));
}
/**
* @brief Check whether Argobots has been initialized.
*
* @return true if Argobots has been initialized.
*/
static bool initialized() {
return ABT_initialized() == ABT_TRUE;
}
/**
* @brief Finalizes Argobots.
*/
static void finalize() {
TL_ABT_ASSERT(ABT_finalize());
}
};
}
#undef TL_ABT_EXCEPTION
#undef TL_ABT_ASSERT
#endif
......@@ -21,7 +21,7 @@ class pool;
class xstream;
/**
* Exception class thrown by the mutex class.
* Exception class thrown by the scheduler class.
*/
class scheduler_exception : public exception {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment