Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Taylor committed May 17, 2024
1 parent e9ed800 commit 34b3628
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace hpx { namespace util {
typedef hpx::spinlock mutex_type;

public:
static hpx::mutex mtx_;
static hpx::spinlock mtx_;

static bool enabled_;
static bool has_called_init_;
Expand All @@ -123,7 +123,6 @@ namespace hpx { namespace util {
static int init_val_;
static std::vector<openshmem_seginfo_t> segments;
static std::uint8_t* shmem_buffer;
static std::size_t this_rank;
};
}} // namespace hpx::util

Expand Down
14 changes: 4 additions & 10 deletions libs/core/openshmem_base/src/openshmem_environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,12 @@ namespace hpx::util {

namespace hpx::util {

hpx::mutex openshmem_environment::mtx_{};
hpx::spinlock openshmem_environment::mtx_;
bool openshmem_environment::enabled_ = false;
bool openshmem_environment::has_called_init_ = false;
int openshmem_environment::provided_threading_flag_ = 0;
int openshmem_environment::is_initialized_ = -1;
int openshmem_environment::init_val_ = 0;
std::size_t openshmem_environment::this_rank = -1;
//std::vector<std::shared_ptr<hpx::spinlock>> openshmem_environment::segment_mutex{};
std::vector<openshmem_seginfo_t> openshmem_environment::segments{};
std::uint8_t* hpx::util::openshmem_environment::shmem_buffer = nullptr;
Expand Down Expand Up @@ -224,11 +223,6 @@ namespace hpx::util {
if (enabled_)
return; // don't call twice

if (enabled()) {
scoped_lock l;
this_rank = static_cast<int>(shmem_my_pe());
}

has_called_init_ = false;

// We assume to use the OpenSHMEM parcelport if it is not explicitly disabled
Expand Down Expand Up @@ -261,7 +255,7 @@ namespace hpx::util {
}

#if defined(HPX_HAVE_NETWORKING)
if (this_rank == 0)
if (rank() == 0)
{
rtcfg.mode_ = hpx::runtime_mode::console;
}
Expand All @@ -275,7 +269,7 @@ namespace hpx::util {
rtcfg.mode_ = hpx::runtime_mode::local;
#endif

rtcfg.add_entry("hpx.parcel.openshmem.rank", std::to_string(this_rank));
rtcfg.add_entry("hpx.parcel.openshmem.rank", std::to_string(rank()));
rtcfg.add_entry(
"hpx.parcel.openshmem.processorname", get_processor_name());
}
Expand Down Expand Up @@ -500,7 +494,7 @@ namespace hpx::util {

int openshmem_environment::rank()
{
return this_rank;
return shmem_my_pe();
}

openshmem_environment::scoped_lock::scoped_lock()
Expand Down

0 comments on commit 34b3628

Please sign in to comment.