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)

  • streamId – The stream index to use for accessing stream specific resources such as scan compaction arrays and buffers

  • append – If true scattered messages will append to the existing message list, otherwise truncate

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)

  • streamId – The stream index to use for accessing stream specific resources such as scan compaction arrays and buffers

Returns

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

inline const CUDAMsgMap &getReadList()
Returns

Returns the map<variable_name, device_ptr> for reading message data

inline const CUDAMsgMap &getWriteList()
Returns

Returns the map<variable_name, device_ptr> for writing message data (aka swap buffers)

Protected Functions

void allocateDeviceMessageList(CUDAMsgMap &memory_map)

Allocates device memory for the provided message list

Parameters

memory_map – Message list to perform operation on

void releaseDeviceMessageList(CUDAMsgMap &memory_map)

Frees device memory for the provided message list

Parameters

memory_map – Message list to perform operation on

void zeroDeviceMessageList(CUDAMsgMap &memory_map)

Zeros device memory for the provided message list

Parameters

memory_map – Message list to perform operation on