Program Listing for File FLAMEGPUDeviceException.cuh

Return to documentation for file (include/flamegpu/exception/FLAMEGPUDeviceException.cuh)

#ifndef INCLUDE_FLAMEGPU_EXCEPTION_FLAMEGPUDEVICEEXCEPTION_CUH_
#define INCLUDE_FLAMEGPU_EXCEPTION_FLAMEGPUDEVICEEXCEPTION_CUH_

#include <string>
#include <type_traits>

#include "flamegpu/simulation/detail/CUDAScanCompaction.h"

#if !defined(FLAMEGPU_SEATBELTS) || FLAMEGPU_SEATBELTS

#include "flamegpu/exception/FLAMEGPUDeviceException_device.cuh"

namespace flamegpu {
namespace exception {

class DeviceExceptionManager {
 public:
    DeviceExceptionManager();
    ~DeviceExceptionManager();
    DeviceExceptionBuffer *getDevicePtr(unsigned int streamId, cudaStream_t stream);
    void checkError(const std::string &function, unsigned int streamId, cudaStream_t stream);

 private:
    static std::string getLocationString(const DeviceExceptionBuffer &b);
    static std::string getErrorString(const DeviceExceptionBuffer &b);
    DeviceExceptionBuffer *d_buffer[detail::CUDAScanCompaction::MAX_STREAMS];
    DeviceExceptionBuffer hd_buffer[detail::CUDAScanCompaction::MAX_STREAMS];
};
}  // namespace exception
}  // namespace flamegpu
#else
#define DTHROW(nop)
#endif  // FLAMEGPU_SEATBELTS=OFF
#endif  // INCLUDE_FLAMEGPU_EXCEPTION_FLAMEGPUDEVICEEXCEPTION_CUH_