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

Fix debug messages. Aggregation on HBM working.

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