Skip to content

Commit

Permalink
Merge pull request #268 from TESSEorg/TTG-get-world
Browse files Browse the repository at this point in the history
TTG needs get_world() too
  • Loading branch information
evaleev committed Oct 27, 2023
2 parents 3f9087c + c46de71 commit 4643df5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
16 changes: 11 additions & 5 deletions cmake/modules/FindTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,17 @@ findpkg_finish(TBB_MALLOC_PROXY)
#parse all the version numbers from tbb
if(NOT TBB_VERSION)

#only read the start of the file
file(READ
"${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
TBB_VERSION_CONTENTS
LIMIT 2048)
if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
file(STRINGS
"${TBB_INCLUDE_DIR}/oneapi/tbb/version.h"
TBB_VERSION_CONTENTS
REGEX "VERSION")
else()
file(STRINGS
"${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
TBB_VERSION_CONTENTS
REGEX "VERSION")
endif()

string(REGEX REPLACE
".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
Expand Down
3 changes: 3 additions & 0 deletions ttg/ttg/base/tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ namespace ttg {
/// Returns this thread's pointer to the vector of output terminals
static const std::vector<TerminalBase *> *get_outputs_tls_ptr() { return outputs_tls_ptr_accessor(); }

/// @return World in which this lives
virtual ttg::World get_world() const = 0;

/// Returns a pointer to the i'th input terminal
ttg::TerminalBase *in(size_t i) {
if (i >= inputs.size()) throw name + ":TTBase: you are requesting an input terminal that does not exist";
Expand Down
2 changes: 1 addition & 1 deletion ttg/ttg/madness/ttg.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace ttg_madness {
std::array<std::size_t, std::tuple_size_v<actual_input_tuple_type>> static_streamsize;

public:
ttg::World get_world() const { return world; }
ttg::World get_world() const override final { return world; }

protected:
using worldobjT = ::madness::WorldObject<ttT>;
Expand Down
2 changes: 1 addition & 1 deletion ttg/ttg/parsec/ttg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ namespace ttg_parsec {
bool m_defer_writer = TTG_PARSEC_DEFER_WRITER;

public:
ttg::World get_world() const { return world; }
ttg::World get_world() const override final { return world; }

private:
/// dispatches a call to derivedT::op if Space == Host, otherwise to derivedT::op_cuda if Space == CUDA
Expand Down
8 changes: 6 additions & 2 deletions ttg/ttg/tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ namespace ttg {

TTBase *get_op(std::size_t i) { return tts.at(i).get(); }

ttg::World get_world() const override final { return tts[0]->get_world(); }

void fence() { tts[0]->fence(); }

void make_executable() {
Expand Down Expand Up @@ -147,9 +149,11 @@ namespace ttg {

virtual ~SinkTT() {}

void fence() {}
void fence() override final {}

void make_executable() override final { TTBase::make_executable(); }

void make_executable() { TTBase::make_executable(); }
World get_world() const override final { return get_default_world(); }

/// Returns pointer to input terminal i to facilitate connection --- terminal cannot be copied, moved or assigned
template <std::size_t i>
Expand Down

0 comments on commit 4643df5

Please sign in to comment.