Class CUDAMacroEnvironment

Nested Relationships

Class Documentation

class flamegpu::CUDAMacroEnvironment

This class is CUDASimulation’s internal handler for macro environment functionality

Public Functions

CUDAMacroEnvironment(const EnvironmentDescription &description, const CUDASimulation &_cudaSimulation)

Normal constructor

Parameters
  • description – Agent description of the agent

  • _cudaSimulation – Parent CUDASimulation of the agent

CUDAMacroEnvironment(CUDAMacroEnvironment&) = delete
CUDAMacroEnvironment(CUDAMacroEnvironment&&) = delete
void init()

Performs CUDA allocations, and registers CURVE variables

void init(const SubEnvironmentData &mapping, const CUDAMacroEnvironment &master_macro_env)

Performs CUDA allocations, and registers CURVE variables Initialises submodel mappings too

Note

This must be called after the master model CUDAMacroEnvironment has init

Parameters
  • mapping – The SubEnvironment mapping info

  • master_macro_env – The master model’s macro env to map sub macro properties with

void free()

Release all CUDA allocations, and unregisters CURVE variables

void purge()

Clears all CUDA pointers without deallocating, (e.g. if device has been reset)

void mapRuntimeVariables() const

Register the properties to CURVE for use within the passed agent function

void unmapRuntimeVariables() const

Release the properties from CURVE as registered for use within the passed agent function

void mapRTCVariables(detail::curve::CurveRTCHost &curve_header) const

Register the properties to the provided RTC header

Parameters

curve_header – The RTC header to act upon

void unmapRTCVariables(detail::curve::CurveRTCHost &curve_header) const

Release the properties to the provided RTC header

Parameters

curve_header – The RTC header to act upon

void resetFlagsAsync(const std::vector<cudaStream_t> &streams)

Reset the flags used by seatbelts to catch potential race conditions

Parameters

streams – Streams to async reset over

bool getDeviceReadFlag(const std::string &property_name)

Returns the current state of the device read flag for the named macro property

Parameters

property_name – Name of the macro property to query

bool getDeviceWriteFlag(const std::string &property_name)

Returns the current state of the device read flag for the named macro property

Parameters

property_name – Name of the macro property to query

unsigned int getDeviceRWFlags(const std::string &property_name)

Returns the raw flag variable used for read write flag for the named macro property

Note

This means both can be checked with a single memcpy

Note

Bit 0 being set means read has occurred, bit 1 being set means write has occurred

Parameters

property_name – Name of the macro property to query

template<typename T, unsigned int I, unsigned int J, unsigned int K, unsigned int W>
HostMacroProperty<T, I, J, K, W> getProperty(const std::string &name)

Returns a HostAPI style direct accessor the macro property

Parameters

name – Name of the macro property

Template Parameters
  • T – Type of the macro property

  • I – 1st dimension length

  • J – 2nd dimension length

  • K – 3rd dimension length

  • W – 4th dimension length