Skip to content

Commit

Permalink
Fix docstring(s) attributed to the flamegpu namespace (#1169)
Browse files Browse the repository at this point in the history
* Fix docstrings wrongly attributed to the flamegpu namespace

* Document the flamegpu namespace in flamegpu.h
  • Loading branch information
ptheywood authored Jan 12, 2024
1 parent 5b97492 commit a3bd48e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 24 deletions.
11 changes: 6 additions & 5 deletions include/flamegpu/detail/cuda.cuh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#ifndef INCLUDE_FLAMEGPU_DETAIL_CUDA_CUH_
#define INCLUDE_FLAMEGPU_DETAIL_CUDA_CUH_

/**
* Collection of cuda related utility methods for internal use.
* Mostly to allow for graceful handling of device resets when cuda is called by dtors
* @todo - we should check for unified addressing support prior to use of cudaPointerGetAttributes, but it should be available for all valide flamegpu targets (x64 linux and windows). Tegra's might be an edge case.
*/
#include <cuda_runtime.h>
#include <cuda.h>
#include <limits>
#include "flamegpu/exception/FLAMEGPUException.h"

namespace flamegpu {
namespace detail {

/**
* Collection of cuda related utility methods for internal use.
* Mostly to allow for graceful handling of device resets when cuda is called by dtors
* @todo - we should check for unified addressing support prior to use of cudaPointerGetAttributes, but it should be available for all valid flamegpu targets (x64 linux and windows). Tegra's might be an edge case.
*/
namespace cuda {

/**
Expand Down
4 changes: 1 addition & 3 deletions include/flamegpu/detail/curand.cuh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#ifndef INCLUDE_FLAMEGPU_DETAIL_CURAND_CUH_
#define INCLUDE_FLAMEGPU_DETAIL_CURAND_CUH_

/**
* This header exists to allow a convenient way to switch between curand implementations
*/
// This header exists to allow a convenient way to switch between curand implementations

#include <curand_kernel.h>

Expand Down
7 changes: 7 additions & 0 deletions include/flamegpu/flamegpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
#include <glm/glm.hpp>
#endif

/**
* @namespace flamegpu
* The flamegpu namespace containing all namespace'd elements of the flamegpu api.
*
* The inner detail namespace and it's members are implementation details not considered part of the public facing API and may change at any time.
*/

// include all host API classes (top level header from each module)
#include "flamegpu/version.h"
#include "flamegpu/runtime/HostAPI.h"
Expand Down
2 changes: 1 addition & 1 deletion include/flamegpu/runtime/detail/curve/Curve.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef __CUDACC_RTC__
#include <string>
#endif
/**
/*
* The main cuRVE header file for the CUDA Runtime Variable Environment (cuRVE)
* Based off the following article http:// www.gamasutra.com/view/news/127915/InDepth_Quasi_CompileTime_String_Hashing.php
* This file contains definitions common to HostCurve and DeviceCurve
Expand Down
10 changes: 5 additions & 5 deletions include/flamegpu/runtime/environment/DeviceMacroProperty.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
#include <limits>
#include <algorithm>

/**
* CUDA does not implement atomicAdd(double*, double) for pre-pascal GPUs, which do not have the underlying hardware instruction.
* A CAS based software implementation is required instead, which will be much slower.
* This implementation is based on the reference implementation prodived by the CUDA toolkit documentation.
*/
#ifdef __CUDACC__
#include <cuda_runtime.h>
// Needs to be mutually exclusive with definitions in CUDA's sm_60_atomic_functions.h
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ < 600
/**
* CUDA does not implement atomicAdd(double*, double) for pre-pascal GPUs, which do not have the underlying hardware instruction.
* A CAS based software implementation is required instead, which will be much slower.
* This implementation is based on the reference implementation provided by the CUDA toolkit documentation.
*/
__device__ __forceinline__ double atomicAdd(double* address, double val) {
// cpplint enforces uint64_t, but atomicCAS is implemented for unsigned long long int
unsigned long long int* address_as_ull = reinterpret_cast<unsigned long long int*>(address); // NOLINT(runtime/int)
Expand Down
4 changes: 2 additions & 2 deletions include/flamegpu/simulation/AgentVector_Agent.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef INCLUDE_FLAMEGPU_SIMULATION_AGENTVECTOR_AGENT_H_
#define INCLUDE_FLAMEGPU_SIMULATION_AGENTVECTOR_AGENT_H_

/**
* THIS CLASS SHOULD NOT BE INCLUDED DIRECTLY
/*
* THIS HEADER SHOULD NOT BE INCLUDED DIRECTLY
* Include flamegpu/simulation/AgentVector.h instead
* Use AgentVector::CAgent instead of AgentVector_CAgent
* Use AgentVector::Agent instead of AgentVector_Agent
Expand Down
4 changes: 2 additions & 2 deletions include/flamegpu/util/cleanup.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef INCLUDE_FLAMEGPU_UTIL_CLEANUP_H_
#define INCLUDE_FLAMEGPU_UTIL_CLEANUP_H_

/**
* Prodvides a utility method to cleanup after flamegpu. Currently for the only implementation (CUDA) this resets all devices.
/*
* Provides a utility method to cleanup after flamegpu. Currently for the only implementation (CUDA) this resets all devices.
*/

namespace flamegpu {
Expand Down
12 changes: 6 additions & 6 deletions include/flamegpu/util/nvtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@

#include <cstdint>

/**
* Utility namespace for handling of NVTX profiling markers/ranges, uses if constexpr to avoid runtime cost when disabled
*
* Macro `FLAMEGPU_USE_NVTX` is defined via CMake to set the member constexpr
*/

// If NVTX is enabled, include header, defined namespace / class and macros.
#if defined(FLAMEGPU_USE_NVTX)
// Include the appropriate header if enabled
Expand All @@ -27,6 +21,12 @@

namespace flamegpu {
namespace util {

/**
* Utility namespace for handling of NVTX profiling markers/ranges, uses if constexpr to avoid runtime cost when disabled
*
* Macro `FLAMEGPU_USE_NVTX` is defined via CMake to set the member constexpr
*/
namespace nvtx {

/**
Expand Down

0 comments on commit a3bd48e

Please sign in to comment.