Class CUDAMacroEnvironment

Nested Relationships

Nested Types

Class Documentation

class CUDAMacroEnvironment

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

Public Functions

CUDAMacroEnvironment(const EnvironmentData &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(cudaStream_t stream)

Performs CUDA allocations, and registers CURVE variables

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

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

  • stream – The CUDAStream to use for CUDA operations

void free()

Release all CUDA allocations, and unregisters CURVE variables

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 registerCurveVariables(detail::curve::HostCurve &curve) const

Register (and set) all owned macro properties within the specified curve instance

Parameters

curve – The curve instance 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