Class CUDAMessageList

Class Documentation

class CUDAMessageList

This is the internal device memory handler for CUDAMessage

Todo:

This could just be merged with CUDAMessage

Public Functions

explicit CUDAMessageList(CUDAMessage &cuda_message, CUDAScatter &scatter, const unsigned int &streamId)

populates CUDA message map

Initially allocates message lists based on cuda_message.getMaximumListSize()

CUDAMessageList class

virtual ~CUDAMessageList()

Destroys the CUDAMessageList object.

Frees all message list memory

A destructor.

void cleanupAllocatedData()

Release all variable array memory in each list to 0

void *getReadMessageListVariablePointer(std::string variable_name)

Returns a pointer to the memory for the named variable in d_list

Parameters

variable_name – Name of the variable to get pointer to

Returns

void pointer to variable array in device memory

void *getWriteMessageListVariablePointer(std::string variable_name)

Returns a pointer to the memory for the named variable in d_swap_list

Parameters

variable_name – Name of the variable to get pointer to

Returns

void pointer to variable array in device memory

void zeroMessageData()

Memset all variable arrays in each list to 0

virtual void swap()

Swap d_list and d_swap_list

virtual unsigned int scatter(const unsigned int &newCount, CUDAScatter &scatter, const unsigned int &streamId, const bool &append)

Perform a compaction using d_msg_scan_flag and d_msg_position

Parameters
  • newCount – Number of new messages to be scattered

  • scatter – Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)

Returns

Total number of messages now in list (includes old + new counts if appending)

virtual unsigned int scatterAll(const unsigned int &newCount, CUDAScatter &scatter, const unsigned int &streamId)

Copy all message data from d_swap_list to d_list This ALWAYS performs and append to the existing message list count Used by swap() when appending messagelists

Parameters
  • newCount – Number of new messages to be scattered

  • scatter – Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)

Returns

Total number of messages now in list (includes old + new counts)

inline const CUDAMsgMap &getReadList()
inline const CUDAMsgMap &getWriteList()

Protected Functions

void allocateDeviceMessageList(CUDAMsgMap &Message_list)

Allocates Device message list.

Allocates device memory for the provided message list

Parameters
  • Message_list – Message list to perform operation on

  • variable – of type CUDAMessageMap struct type

Returns

none

void releaseDeviceMessageList(CUDAMsgMap &Message_list)

Frees.

Frees device memory for the provided message list

Parameters
  • Message_list – Message list to perform operation on

  • variable – of type CUDAMsgMap struct type

Returns

none

void zeroDeviceMessageList(CUDAMsgMap &Message_list)

Zeros device memory for the provided message list

Parameters
  • Message_list – Message list to perform operation on

  • variable – of type CUDAMsgMap struct type

Returns

none