Skip to content

Commit

Permalink
remove win nullptr check
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikvn committed Jan 8, 2023
1 parent bace5e3 commit e73cc92
Showing 1 changed file with 17 additions and 40 deletions.
57 changes: 17 additions & 40 deletions include/ginkgo/core/base/mpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,9 +1606,7 @@ class window {
*/
void fence(int assert = 0) const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_fence(assert, this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_fence(assert, this->window_));
}

/**
Expand All @@ -1622,16 +1620,14 @@ class window {
void lock(int rank, lock_type lock_t = lock_type::shared,
int assert = 0) const
{
if (&this->window_) {
if (lock_t == lock_type::shared) {
GKO_ASSERT_NO_MPI_ERRORS(
MPI_Win_lock(MPI_LOCK_SHARED, rank, assert, this->window_));
} else if (lock_t == lock_type::exclusive) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank,
assert, this->window_));
} else {
GKO_NOT_IMPLEMENTED;
}
if (lock_t == lock_type::shared) {
GKO_ASSERT_NO_MPI_ERRORS(
MPI_Win_lock(MPI_LOCK_SHARED, rank, assert, this->window_));
} else if (lock_t == lock_type::exclusive) {
GKO_ASSERT_NO_MPI_ERRORS(
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, assert, this->window_));
} else {
GKO_NOT_IMPLEMENTED;
}
}

Expand All @@ -1643,9 +1639,7 @@ class window {
*/
void unlock(int rank) const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_unlock(rank, this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_unlock(rank, this->window_));
}

/**
Expand All @@ -1656,9 +1650,7 @@ class window {
*/
void lock_all(int assert = 0) const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_lock_all(assert, this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_lock_all(assert, this->window_));
}

/**
Expand All @@ -1667,9 +1659,7 @@ class window {
*/
void unlock_all() const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_unlock_all(this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_unlock_all(this->window_));
}

/**
Expand All @@ -1680,9 +1670,7 @@ class window {
*/
void flush(int rank) const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush(rank, this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush(rank, this->window_));
}

/**
Expand All @@ -1693,9 +1681,7 @@ class window {
*/
void flush_local(int rank) const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush_local(rank, this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush_local(rank, this->window_));
}

/**
Expand All @@ -1704,9 +1690,7 @@ class window {
*/
void flush_all() const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush_all(this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush_all(this->window_));
}

/**
Expand All @@ -1715,20 +1699,13 @@ class window {
*/
void flush_all_local() const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush_local_all(this->window_));
}
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_flush_local_all(this->window_));
}

/**
* Synchronize the public and private buffers for the window object
*/
void sync() const
{
if (&this->window_) {
GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_sync(this->window_));
}
}
void sync() const { GKO_ASSERT_NO_MPI_ERRORS(MPI_Win_sync(this->window_)); }

/**
* The deleter which calls MPI_Win_free when the window leaves its scope.
Expand Down

0 comments on commit e73cc92

Please sign in to comment.