Skip to content

Commit

Permalink
Rename CUDAAgentModel to CUDASimulation
Browse files Browse the repository at this point in the history
  • Loading branch information
ptheywood committed Oct 7, 2020
1 parent 7a3ea99 commit 7c11310
Show file tree
Hide file tree
Showing 122 changed files with 661 additions and 661 deletions.
2 changes: 1 addition & 1 deletion examples/boids_bruteforce/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int main(int argc, const char ** argv) {
/**
* Create Model Runner
*/
CUDAAgentModel cuda_model(model);
CUDASimulation cuda_model(model);

/**
* Create visualisation
Expand Down
2 changes: 1 addition & 1 deletion examples/boids_spatial3D/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ int main(int argc, const char ** argv) {
/**
* Create Model Runner
*/
CUDAAgentModel cuda_model(model);
CUDASimulation cuda_model(model);

/**
* Create visualisation
Expand Down
4 changes: 2 additions & 2 deletions examples/circles_bruteforce/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ int main(int argc, const char ** argv) {
/**
* Create Model Runner
*/
NVTX_PUSH("CUDAAgentModel creation");
CUDAAgentModel cuda_model(model, argc, argv);
NVTX_PUSH("CUDASimulation creation");
CUDASimulation cuda_model(model, argc, argv);
NVTX_POP();

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/circles_spatial3D/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int argc, const char ** argv) {
/**
* Create Model Runner
*/
CUDAAgentModel cuda_model(model, argc, argv);
CUDASimulation cuda_model(model, argc, argv);

/**
* Create visualisation
Expand Down
4 changes: 2 additions & 2 deletions examples/game_of_life/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ int main(int argc, const char ** argv) {
/**
* Create Model Runner
*/
NVTX_PUSH("CUDAAgentModel creation");
CUDAAgentModel cuda_model(model, argc, argv);
NVTX_PUSH("CUDASimulation creation");
CUDASimulation cuda_model(model, argc, argv);
NVTX_POP();

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/host_functions/src/main.cu
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int main(int argc, const char ** argv) {
/**
* Execution
*/
CUDAAgentModel cuda_model(model);
CUDASimulation cuda_model(model);
cuda_model.SimulationConfig().steps = 0;
cuda_model.setPopulationData(population);
cuda_model.initialise(argc, argv);
Expand Down
2 changes: 1 addition & 1 deletion include/flamegpu/exception/FGPUDeviceException.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "flamegpu/exception/FGPUDeviceException_device.h"

/**
* Host 'singleton', owned 1 per CUDAAgentModel, provides facility for generating and checking DeviceExceptionBuffers
* Host 'singleton', owned 1 per CUDASimulation, provides facility for generating and checking DeviceExceptionBuffers
*/
class DeviceExceptionManager {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/flamegpu/flame_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "flamegpu/model/SubAgentDescription.h"
#include "flamegpu/model/SubEnvironmentDescription.h"
#include "flamegpu/pop/AgentPopulation.h"
#include "flamegpu/gpu/CUDAAgentModel.h"
#include "flamegpu/gpu/CUDASimulation.h"
#include "flamegpu/runtime/messaging.h"
#include "flamegpu/runtime/AgentFunction_shim.h"
#include "flamegpu/runtime/AgentFunctionCondition_shim.h"
Expand Down
30 changes: 15 additions & 15 deletions include/flamegpu/gpu/CUDAAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ class CUDAAgent : public AgentInterface {
/**
* Normal constructor
* @param description Agent description of the agent
* @param _cuda_model Parent CUDAAgentModel of the agent
* @param _cuda_model Parent CUDASimulation of the agent
*/
CUDAAgent(const AgentData& description, const CUDAAgentModel &_cuda_model);
CUDAAgent(const AgentData& description, const CUDASimulation &_cuda_model);
/**
* Subagent form constructor, used when creating a CUDAAgent for a mapped agent within a submodel
* @param description Agent description of the agent
* @param _cuda_model Parent CUDAAgentModel of the agent
* @param _cuda_model Parent CUDASimulation of the agent
* @param master_agent The (parent) agent which this is agent is mapped to
* @param mapping Mapping definition for how this agent is connected with its master agent.
*/
CUDAAgent(
const AgentData &description,
const CUDAAgentModel &_cuda_model,
const CUDASimulation &_cuda_model,
const std::unique_ptr<CUDAAgent> &master_agent,
const std::shared_ptr<SubAgentData> &mapping);
/**
Expand All @@ -78,7 +78,7 @@ class CUDAAgent : public AgentInterface {
* Copies population data from the provided host object
* To the device buffers held by this object (overwriting any existing agent data)
* Also updates population size, clears disabled agents
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The index of the agent function within the current layer
* @param population An AgentPopulation object with the same internal AgentData description, to provide the input data
* @note Scatter is required for initialising submodel vars
Expand Down Expand Up @@ -114,7 +114,7 @@ class CUDAAgent : public AgentInterface {
* All disabled agents are scattered to swap
* Only alive agents with deathflag are scattered
* @param func The agent function condition being processed
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The index of the agent function within the current layer
* @see CUDAFatAgent::processDeath(const unsigned int &, const std::string &, const unsigned int &)
*/
Expand All @@ -123,7 +123,7 @@ class CUDAAgent : public AgentInterface {
* Transitions all active agents from the source state to the destination state
* @param _src The source state
* @param _dest The destination state
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The index of the agent function within the current layer
* @see CUDAFatAgent::transitionState(const unsigned int &, const std::string &, const std::string &, const unsigned int &)
*/
Expand All @@ -133,7 +133,7 @@ class CUDAAgent : public AgentInterface {
* Agents which failed the condition are scattered to the front and marked as disabled
* Agents which pass the condition are scattered to after the disabled agents
* @param func The agent function being processed
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The index of the agent function within the current layer
* @see CUDAFatAgent::processFunctionCondition(const unsigned int &, const unsigned int &)
* @note Named state must not already contain disabled agents
Expand All @@ -147,14 +147,14 @@ class CUDAAgent : public AgentInterface {
* @param newSize The number of new agents
* @param d_inBuff The device buffer containing the new agents
* @param offsets This defines how the memory is laid out within d_inBuff
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId This is required for scan compaction arrays and async
*/
void scatterHostCreation(const std::string &state_name, const unsigned int &newSize, char *const d_inBuff, const VarOffsetStruct &offsets, CUDAScatter &scatter, const unsigned int &streamId);
/**
* Sorts all agent variables according to the positions stored inside Message Output scan buffer
* @param state_name The state agents are scattered into
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The stream in which the corresponding agent function has executed
* @see HostAgentInstance::sort(const std::string &, HostAgentInstance::Order, int, int)
*/
Expand All @@ -165,7 +165,7 @@ class CUDAAgent : public AgentInterface {
* @param func_agent The Cuda agent which the agent function belongs to (required so that RTC function instances can be obtained)
* @param func The agent function being processed
* @param maxLen The maximum number of new agents (this will be the size of the agent state executing func)
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId This is required for scan compaction arrays and async
*/
void mapNewRuntimeVariables(const CUDAAgent& func_agent, const AgentFunctionData& func, const unsigned int &maxLen, CUDAScatter &scatter, const unsigned int &streamId);
Expand All @@ -180,7 +180,7 @@ class CUDAAgent : public AgentInterface {
* The device buffer must be packed in the same format as mapNewRuntimeVariables(const AgentFunctionData&, const unsigned int &, const unsigned int &)
* @param func The agent function being processed
* @param newSize The maximum number of new agents (this will be the size of the agent state executing func)
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId This is required for scan compaction arrays and async
*/
void scatterNew(const AgentFunctionData& func, const unsigned int &newSize, CUDAScatter &scatter, const unsigned int &streamId);
Expand All @@ -193,7 +193,7 @@ class CUDAAgent : public AgentInterface {
* Instatiates a RTC Agent function from agent function data description containing the agent function source.
* If function_condition variable is true then this function will instantiate a function condition rather than an agent function
* Uses Jitify to create an instantiation of the program. Any compilation errors in the user provided agent function will be reported here.
* @param kernel_cache The JitCache to use (probably CUDAAgentModel::rtc_kernel_cache)
* @param kernel_cache The JitCache to use (probably CUDASimulation::rtc_kernel_cache)
* @throw InvalidAgentFunc thrown if the user supplied agent function has compilation errors
*/
void addInstantitateRTCFunction(jitify::JitCache &kernel_cache, const AgentFunctionData& func, bool function_condition = false);
Expand All @@ -210,7 +210,7 @@ class CUDAAgent : public AgentInterface {
/**
* Resets the number of agents in any unmapped statelists to 0
* They count as unmapped if they are not mapped to a master state, sub mappings will be reset
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId This is required for scan compaction arrays and async
*/
void initUnmappedVars(CUDAScatter &scatter, const unsigned int &streamId);
Expand Down Expand Up @@ -263,7 +263,7 @@ class CUDAAgent : public AgentInterface {
/**
* The parent model
*/
const CUDAAgentModel &cuda_model;
const CUDASimulation &cuda_model;
/**
* map between function_name (or function_name_condition) and the jitify instance
*/
Expand Down
8 changes: 4 additions & 4 deletions include/flamegpu/gpu/CUDAAgentStateList.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CUDAAgentStateList {
* @param cuda_agent The owning CUDAAgent
* @param _fat_index The owning CUDAAgent's fat index within the CUDAFatAgent
* @param description The owning CUDAAgent's description, used to identify variables
* @param _isSubStateList If true, the statelist is mapped to a master agent (and will be reset after CUDAAgentModel::simulate())
* @param _isSubStateList If true, the statelist is mapped to a master agent (and will be reset after CUDASimulation::simulate())
* @param mapping Mapping definition for how the variables are to their master state.
*/
CUDAAgentStateList(
Expand Down Expand Up @@ -94,7 +94,7 @@ class CUDAAgentStateList {
void scatterHostCreation(const unsigned int &newSize, char *const d_inBuff, const VarOffsetStruct &offsets, CUDAScatter &scatter, const unsigned int &streamId);
/**
* Sorts all agent variables according to the positions stored inside Message Output scan buffer
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The stream in which the corresponding agent function has executed
*/
void scatterSort(CUDAScatter &scatter, const unsigned int &streamId);
Expand Down Expand Up @@ -142,12 +142,12 @@ class CUDAAgentStateList {
*/
const std::shared_ptr<CUDAFatAgentStateList> parent_list;
/**
* If true, the statelist is mapped to a master agent (and will be reset after CUDAAgentModel::simulate())
* If true, the statelist is mapped to a master agent (and will be reset after CUDASimulation::simulate())
*/
const bool isSubStateList;
/**
* These variables are not mapped to a master agent
* Hence they are reset each time CUDAAgentModel::simulate() is called
* Hence they are reset each time CUDASimulation::simulate() is called
*/
std::list<std::shared_ptr<VariableBuffer>> unmappedBuffers;
};
Expand Down
6 changes: 3 additions & 3 deletions include/flamegpu/gpu/CUDAFatAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CUDAFatAgent {
* This updates the alive agent count
* @param agent_fat_id The index of the CUDAAgent within this CUDAFatAgent
* @param state_name The name of the state attached to the named fat agent index
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId Index of the stream used for scan compaction flags (and async cuda ops)
*/
void processDeath(const unsigned int &agent_fat_id, const std::string &state_name, CUDAScatter &scatter, const unsigned int &streamId);
Expand All @@ -96,7 +96,7 @@ class CUDAFatAgent {
* @param agent_fat_id The index of the CUDAAgent within this CUDAFatAgent
* @param _src The name of the source state attached to the named fat agent index
* @param _dest The name of the destination state attached to the named fat agent index
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId Index of the stream used for scan compaction flags (and async cuda ops)
*/
void transitionState(const unsigned int &agent_fat_id, const std::string &_src, const std::string &_dest, CUDAScatter &scatter, const unsigned int &streamId);
Expand All @@ -105,7 +105,7 @@ class CUDAFatAgent {
* Failed agents are sorted to the front and marked as disabled, passing agents are then sorted to the back
* @param agent_fat_id The index of the CUDAAgent within this CUDAFatAgent
* @param state_name The name of the state attached to the named fat agent index
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId Index of the stream used for scan compaction flags (and async cuda ops)
*/
void processFunctionCondition(const unsigned int &agent_fat_id, const std::string &state_name, CUDAScatter &scatter, const unsigned int &streamId);
Expand Down
8 changes: 4 additions & 4 deletions include/flamegpu/gpu/CUDAFatAgentStateList.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ class CUDAFatAgentStateList {
void setAgentCount(const unsigned int &newCount, const bool &resetDisabled = false);
/**
* Scatters all living agents (including disabled, according to the provided stream's death flag)
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The stream in which the corresponding agent function has executed
* @return The number of agents that are still alive (this includes temporarily disabled agents due to agent function condition)
*/
unsigned int scatterDeath(CUDAScatter &scatter, const unsigned int &streamId);
/**
* Scatters all living agents which failed the agent function condition into the swap buffer (there should be no disabled at this time)
* This does not swap buffers or update disabledAgent)
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The stream in which the corresponding agent function has executed
* @return The number of agents that were scattered (the number of agents which failed the condition)
* @see scatterAgentFunctionConditionTrue(const unsigned int &, const unsigned int &)
Expand All @@ -209,7 +209,7 @@ class CUDAFatAgentStateList {
* Scatters all living agents which passed the agent function condition into the swap buffer (there should be no disabled at this time)
* Also swaps the buffers and sets the number of disabled agents
* @param conditionFailCount The number of agents which failed the condition (they should already have been scattered to swap)
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The stream in which the corresponding agent function has executed
* @return The number of agents that were scattered (the number of agents which passed the condition)
* @see scatterAgentFunctionConditionFalse(const unsigned int &)
Expand All @@ -218,7 +218,7 @@ class CUDAFatAgentStateList {
unsigned int scatterAgentFunctionConditionTrue(const unsigned int &conditionFailCount, CUDAScatter &scatter, const unsigned int &streamId);
/**
* Sorts all agent variables according to the positions stored inside Message Output scan buffer
* @param scatter Scatter instance and scan arrays to be used (CUDAAgentModel::singletons->scatter)
* @param scatter Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
* @param streamId The stream in which the corresponding agent function has executed
*/
void scatterSort(CUDAScatter &scatter, const unsigned int &streamId);
Expand Down
Loading

0 comments on commit 7c11310

Please sign in to comment.