Commit 6cd428fa authored by Francois Tessier's avatar Francois Tessier

Fix debug messages. Aggregation on HBM working.

parent 8e32bf2f
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "tp_utils.hpp" #include "tp_utils.hpp"
#include "tp_memory_interface.hpp" #include "tp_memory_interface.hpp"
#include <pmi.h> #include <hbwmalloc.h>
class Memory: public iMemory { class Memory: public iMemory {
public: public:
...@@ -29,12 +29,24 @@ public: ...@@ -29,12 +29,24 @@ public:
{ {
case DDR: case DDR:
if ( this->masterRank_ ) { if ( this->masterRank_ ) {
printMsg ( DEBUG, "Allocate memory on DDR (%s:%d)\n", __FILE__, __LINE__ );
this->buffer_ = malloc ( this->buffSize_ ); this->buffer_ = malloc ( this->buffSize_ );
MPI_Win_create ( this->buffer_, this->buffSize_, 1, MPI_INFO_NULL, this->comm_, &this->RMAWin_ ); MPI_Win_create ( this->buffer_, this->buffSize_, 1, MPI_INFO_NULL, this->comm_, &this->RMAWin_ );
} }
else else
MPI_Win_create ( NULL, 0, 1, MPI_INFO_NULL, this->comm_, &this->RMAWin_ ); MPI_Win_create ( NULL, 0, 1, MPI_INFO_NULL, this->comm_, &this->RMAWin_ );
MPI_Win_fence (0, this->RMAWin_ );
break;
case HBM:
if ( this->masterRank_ ) {
printMsg ( DEBUG, "Allocate memory on HBM (%s:%d)\n", __FILE__, __LINE__ );
this->buffer_ = hbw_malloc ( this->buffSize_ );
MPI_Win_create ( this->buffer_, this->buffSize_, 1, MPI_INFO_NULL, this->comm_, &this->RMAWin_ );
}
else
MPI_Win_create ( NULL, 0, 1, MPI_INFO_NULL, this->comm_, &this->RMAWin_ );
MPI_Win_fence (0, this->RMAWin_ ); MPI_Win_fence (0, this->RMAWin_ );
break; break;
default: default:
...@@ -51,8 +63,17 @@ public: ...@@ -51,8 +63,17 @@ public:
{ {
case DDR: case DDR:
MPI_Win_free ( &this->RMAWin_ ); MPI_Win_free ( &this->RMAWin_ );
if ( this->masterRank_ ) if ( this->masterRank_ ) {
printMsg ( DEBUG, "Free memory on DDR (%s:%d)\n", __FILE__, __LINE__ );
free ( this->buffer_ ); free ( this->buffer_ );
}
break;
case HBM:
MPI_Win_free ( &this->RMAWin_ );
if ( this->masterRank_ ) {
printMsg ( DEBUG, "Free memory on HBM (%s:%d)\n", __FILE__, __LINE__ );
hbw_free ( this->buffer_ );
}
break; break;
default: default:
printMsg ( ERROR, "Unable to free memory (mem = %s)\n", this->memName () ); printMsg ( ERROR, "Unable to free memory (mem = %s)\n", this->memName () );
...@@ -70,6 +91,7 @@ public: ...@@ -70,6 +91,7 @@ public:
switch ( this->mem_ ) switch ( this->mem_ )
{ {
case DDR: case DDR:
case HBM:
err = MPI_Put ( srcBuffer, srcSize, MPI_BYTE, destRank, offset, srcSize, MPI_BYTE, this->RMAWin_ ); err = MPI_Put ( srcBuffer, srcSize, MPI_BYTE, destRank, offset, srcSize, MPI_BYTE, this->RMAWin_ );
break; break;
default: default:
...@@ -87,6 +109,7 @@ public: ...@@ -87,6 +109,7 @@ public:
switch ( this->mem_ ) switch ( this->mem_ )
{ {
case DDR: case DDR:
case HBM:
err = MPI_Get ( srcBuffer, srcSize, MPI_BYTE, destRank, offset, srcSize, MPI_BYTE, this->RMAWin_ ); err = MPI_Get ( srcBuffer, srcSize, MPI_BYTE, destRank, offset, srcSize, MPI_BYTE, this->RMAWin_ );
break; break;
default: default:
...@@ -104,6 +127,7 @@ public: ...@@ -104,6 +127,7 @@ public:
switch ( this->mem_ ) switch ( this->mem_ )
{ {
case DDR: case DDR:
case HBM:
MPI_Win_fence ( 0, this->RMAWin_ ); MPI_Win_fence ( 0, this->RMAWin_ );
break; break;
default: default:
......
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