![]() |
Astaroth
2.2
|
#include <cuda_runtime_api.h>#include <float.h>#include <stdio.h>#include <stdlib.h>#include "user_defines.h"
Include dependency graph for astaroth.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | AcMatrix |
| struct | AcMeshInfo |
| struct | AcMesh |
| struct | Grid |
| struct | DeviceConfiguration |
Macros | |
| #define | STENCIL_ORDER (6) |
| #define | NGHOST (STENCIL_ORDER / 2) |
| #define | VERBOSE_PRINTING (1) |
| #define | AC_REAL_MAX (FLT_MAX) |
| #define | AC_REAL_MIN (FLT_MIN) |
| #define | AC_REAL_EPSILON (FLT_EPSILON) |
| #define | STREAM_ALL (NUM_STREAMS) |
| #define | AC_GEN_ID(X) X, |
| #define | _UNUSED __attribute__((unused)) |
| #define | AC_GEN_STR(X) #X, |
Typedefs | |
| typedef float | AcReal |
| typedef float3 | AcReal3 |
| typedef struct device_s * | Device |
| typedef struct node_s * | Node |
Enumerations | |
| enum | AcResult { AC_SUCCESS = 0, AC_FAILURE = 1 } |
| enum | ReductionType { RTYPE_MAX, RTYPE_MIN, RTYPE_RMS, RTYPE_RMS_EXP, RTYPE_SUM, NUM_REDUCTION_TYPES } |
| enum | Stream { STREAM_DEFAULT, STREAM_0, STREAM_1, STREAM_2, STREAM_3, STREAM_4, STREAM_5, STREAM_6, STREAM_7, STREAM_8, STREAM_9, STREAM_10, STREAM_11, STREAM_12, STREAM_13, STREAM_14, STREAM_15, STREAM_16, NUM_STREAMS } |
| enum | AcIntParam { AC_FOR_USER_INT_PARAM_TYPES } |
| enum | AcInt3Param { AC_FOR_USER_INT3_PARAM_TYPES } |
| enum | AcRealParam { AC_FOR_USER_REAL_PARAM_TYPES } |
| enum | AcReal3Param { AC_FOR_USER_REAL3_PARAM_TYPES } |
| enum | ScalarArrayHandle { AC_FOR_SCALARARRAY_HANDLES } |
| enum | VertexBufferHandle { AC_FOR_VTXBUF_HANDLES } |
Functions | |
| AcResult | acInit (const AcMeshInfo mesh_info) |
| AcResult | acQuit (void) |
| AcResult | acCheckDeviceAvailability (void) |
| AcResult | acSynchronizeStream (const Stream stream) |
| AcResult | acSynchronizeMesh (void) |
| AcResult | acLoadDeviceConstant (const AcRealParam param, const AcReal value) |
| AcResult | acLoad (const AcMesh host_mesh) |
| AcResult | acStore (AcMesh *host_mesh) |
| AcResult | acIntegrate (const AcReal dt) |
| AcResult | acBoundcondStep (void) |
| AcReal | acReduceScal (const ReductionType rtype, const VertexBufferHandle vtxbuf_handle) |
| AcReal | acReduceVec (const ReductionType rtype, const VertexBufferHandle a, const VertexBufferHandle b, const VertexBufferHandle c) |
| AcResult | acStoreWithOffset (const int3 dst, const size_t num_vertices, AcMesh *host_mesh) |
| AcResult | acIntegrateStep (const int isubstep, const AcReal dt) |
| AcResult | acIntegrateStepWithOffset (const int isubstep, const AcReal dt, const int3 start, const int3 end) |
| AcResult | acSynchronize (void) |
| AcResult | acLoadWithOffset (const AcMesh host_mesh, const int3 src, const int num_vertices) |
| int | acGetNumDevicesPerNode (void) |
| Node | acGetNode (void) |
| AcResult | acNodeCreate (const int id, const AcMeshInfo node_config, Node *node) |
| AcResult | acNodeDestroy (Node node) |
| AcResult | acNodePrintInfo (const Node node) |
| AcResult | acNodeQueryDeviceConfiguration (const Node node, DeviceConfiguration *config) |
| AcResult | acNodeAutoOptimize (const Node node) |
| AcResult | acNodeSynchronizeStream (const Node node, const Stream stream) |
| AcResult | acNodeSynchronizeVertexBuffer (const Node node, const Stream stream, const VertexBufferHandle vtxbuf_handle) |
| AcResult | acNodeSynchronizeMesh (const Node node, const Stream stream) |
| AcResult | acNodeSwapBuffers (const Node node) |
| AcResult | acNodeLoadConstant (const Node node, const Stream stream, const AcRealParam param, const AcReal value) |
| AcResult | acNodeLoadVertexBufferWithOffset (const Node node, const Stream stream, const AcMesh host_mesh, const VertexBufferHandle vtxbuf_handle, const int3 src, const int3 dst, const int num_vertices) |
| AcResult | acNodeLoadMeshWithOffset (const Node node, const Stream stream, const AcMesh host_mesh, const int3 src, const int3 dst, const int num_vertices) |
| AcResult | acNodeLoadVertexBuffer (const Node node, const Stream stream, const AcMesh host_mesh, const VertexBufferHandle vtxbuf_handle) |
| AcResult | acNodeLoadMesh (const Node node, const Stream stream, const AcMesh host_mesh) |
| AcResult | acNodeStoreVertexBufferWithOffset (const Node node, const Stream stream, const VertexBufferHandle vtxbuf_handle, const int3 src, const int3 dst, const int num_vertices, AcMesh *host_mesh) |
| AcResult | acNodeStoreMeshWithOffset (const Node node, const Stream stream, const int3 src, const int3 dst, const int num_vertices, AcMesh *host_mesh) |
| AcResult | acNodeStoreVertexBuffer (const Node node, const Stream stream, const VertexBufferHandle vtxbuf_handle, AcMesh *host_mesh) |
| AcResult | acNodeStoreMesh (const Node node, const Stream stream, AcMesh *host_mesh) |
| AcResult | acNodeIntegrateSubstep (const Node node, const Stream stream, const int step_number, const int3 start, const int3 end, const AcReal dt) |
| AcResult | acNodeIntegrate (const Node node, const AcReal dt) |
| AcResult | acNodePeriodicBoundcondStep (const Node node, const Stream stream, const VertexBufferHandle vtxbuf_handle) |
| AcResult | acNodePeriodicBoundconds (const Node node, const Stream stream) |
| AcResult | acNodeReduceScal (const Node node, const Stream stream, const ReductionType rtype, const VertexBufferHandle vtxbuf_handle, AcReal *result) |
| AcResult | acNodeReduceVec (const Node node, const Stream stream_type, const ReductionType rtype, const VertexBufferHandle vtxbuf0, const VertexBufferHandle vtxbuf1, const VertexBufferHandle vtxbuf2, AcReal *result) |
| AcResult | acDeviceCreate (const int id, const AcMeshInfo device_config, Device *device) |
| AcResult | acDeviceDestroy (Device device) |
| AcResult | acDevicePrintInfo (const Device device) |
| AcResult | acDeviceAutoOptimize (const Device device) |
| AcResult | acDeviceSynchronizeStream (const Device device, const Stream stream) |
| AcResult | acDeviceSwapBuffers (const Device device) |
| AcResult | acDeviceLoadScalarUniform (const Device device, const Stream stream, const AcRealParam param, const AcReal value) |
| AcResult | acDeviceLoadVectorUniform (const Device device, const Stream stream, const AcReal3Param param, const AcReal3 value) |
| AcResult | acDeviceLoadIntUniform (const Device device, const Stream stream, const AcIntParam param, const int value) |
| AcResult | acDeviceLoadInt3Uniform (const Device device, const Stream stream, const AcInt3Param param, const int3 value) |
| AcResult | acDeviceLoadScalarArray (const Device device, const Stream stream, const ScalarArrayHandle handle, const size_t start, const AcReal *data, const size_t num) |
| AcResult | acDeviceLoadMeshInfo (const Device device, const AcMeshInfo device_config) |
| AcResult | acDeviceLoadDefaultUniforms (const Device device) |
| AcResult | acDeviceLoadVertexBufferWithOffset (const Device device, const Stream stream, const AcMesh host_mesh, const VertexBufferHandle vtxbuf_handle, const int3 src, const int3 dst, const int num_vertices) |
| AcResult | acDeviceLoadMeshWithOffset (const Device device, const Stream stream, const AcMesh host_mesh, const int3 src, const int3 dst, const int num_vertices) |
| AcResult | acDeviceLoadVertexBuffer (const Device device, const Stream stream, const AcMesh host_mesh, const VertexBufferHandle vtxbuf_handle) |
| AcResult | acDeviceLoadMesh (const Device device, const Stream stream, const AcMesh host_mesh) |
| AcResult | acDeviceStoreVertexBufferWithOffset (const Device device, const Stream stream, const VertexBufferHandle vtxbuf_handle, const int3 src, const int3 dst, const int num_vertices, AcMesh *host_mesh) |
| AcResult | acDeviceStoreMeshWithOffset (const Device device, const Stream stream, const int3 src, const int3 dst, const int num_vertices, AcMesh *host_mesh) |
| AcResult | acDeviceStoreVertexBuffer (const Device device, const Stream stream, const VertexBufferHandle vtxbuf_handle, AcMesh *host_mesh) |
| AcResult | acDeviceStoreMesh (const Device device, const Stream stream, AcMesh *host_mesh) |
| AcResult | acDeviceTransferVertexBufferWithOffset (const Device src_device, const Stream stream, const VertexBufferHandle vtxbuf_handle, const int3 src, const int3 dst, const int num_vertices, Device dst_device) |
| AcResult | acDeviceTransferMeshWithOffset (const Device src_device, const Stream stream, const int3 src, const int3 dst, const int num_vertices, Device *dst_device) |
| AcResult | acDeviceTransferVertexBuffer (const Device src_device, const Stream stream, const VertexBufferHandle vtxbuf_handle, Device dst_device) |
| AcResult | acDeviceTransferMesh (const Device src_device, const Stream stream, Device dst_device) |
| AcResult | acDeviceIntegrateSubstep (const Device device, const Stream stream, const int step_number, const int3 start, const int3 end, const AcReal dt) |
| AcResult | acDevicePeriodicBoundcondStep (const Device device, const Stream stream, const VertexBufferHandle vtxbuf_handle, const int3 start, const int3 end) |
| AcResult | acDevicePeriodicBoundconds (const Device device, const Stream stream, const int3 start, const int3 end) |
| AcResult | acDeviceReduceScal (const Device device, const Stream stream, const ReductionType rtype, const VertexBufferHandle vtxbuf_handle, AcReal *result) |
| AcResult | acDeviceReduceVec (const Device device, const Stream stream_type, const ReductionType rtype, const VertexBufferHandle vtxbuf0, const VertexBufferHandle vtxbuf1, const VertexBufferHandle vtxbuf2, AcReal *result) |
| AcResult | acDeviceRunMPITest (void) |
| #define _UNUSED __attribute__((unused)) |
| #define AC_GEN_ID | ( | X | ) | X, |
| #define AC_GEN_STR | ( | X | ) | #X, |
| #define AC_REAL_EPSILON (FLT_EPSILON) |
| #define AC_REAL_MAX (FLT_MAX) |
| #define AC_REAL_MIN (FLT_MIN) |
| #define NGHOST (STENCIL_ORDER / 2) |
| #define STENCIL_ORDER (6) |
| #define STREAM_ALL (NUM_STREAMS) |
| #define VERBOSE_PRINTING (1) |
| typedef float AcReal |
| typedef float3 AcReal3 |
| enum AcInt3Param |
| enum AcIntParam |
| enum AcReal3Param |
| enum AcRealParam |
| enum AcResult |
| enum ReductionType |
| enum ScalarArrayHandle |
| enum Stream |
| enum VertexBufferHandle |
| AcResult acBoundcondStep | ( | void | ) |
Applies periodic boundary conditions for the Mesh distributed among the devices visible to the caller
| AcResult acCheckDeviceAvailability | ( | void | ) |
Checks whether there are any CUDA devices available. Returns AC_SUCCESS if there is 1 or more, AC_FAILURE otherwise.
| AcResult acDeviceCreate | ( | const int | id, |
| const AcMeshInfo | device_config, | ||
| Device * | device | ||
| ) |
| AcResult acDeviceIntegrateSubstep | ( | const Device | device, |
| const Stream | stream, | ||
| const int | step_number, | ||
| const int3 | start, | ||
| const int3 | end, | ||
| const AcReal | dt | ||
| ) |
| AcResult acDeviceLoadInt3Uniform | ( | const Device | device, |
| const Stream | stream, | ||
| const AcInt3Param | param, | ||
| const int3 | value | ||
| ) |
| AcResult acDeviceLoadIntUniform | ( | const Device | device, |
| const Stream | stream, | ||
| const AcIntParam | param, | ||
| const int | value | ||
| ) |
| AcResult acDeviceLoadMeshInfo | ( | const Device | device, |
| const AcMeshInfo | device_config | ||
| ) |
| AcResult acDeviceLoadMeshWithOffset | ( | const Device | device, |
| const Stream | stream, | ||
| const AcMesh | host_mesh, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices | ||
| ) |
Deprecated
| AcResult acDeviceLoadScalarArray | ( | const Device | device, |
| const Stream | stream, | ||
| const ScalarArrayHandle | handle, | ||
| const size_t | start, | ||
| const AcReal * | data, | ||
| const size_t | num | ||
| ) |
| AcResult acDeviceLoadScalarUniform | ( | const Device | device, |
| const Stream | stream, | ||
| const AcRealParam | param, | ||
| const AcReal | value | ||
| ) |
| AcResult acDeviceLoadVectorUniform | ( | const Device | device, |
| const Stream | stream, | ||
| const AcReal3Param | param, | ||
| const AcReal3 | value | ||
| ) |
| AcResult acDeviceLoadVertexBuffer | ( | const Device | device, |
| const Stream | stream, | ||
| const AcMesh | host_mesh, | ||
| const VertexBufferHandle | vtxbuf_handle | ||
| ) |
| AcResult acDeviceLoadVertexBufferWithOffset | ( | const Device | device, |
| const Stream | stream, | ||
| const AcMesh | host_mesh, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices | ||
| ) |
| AcResult acDevicePeriodicBoundconds | ( | const Device | device, |
| const Stream | stream, | ||
| const int3 | start, | ||
| const int3 | end | ||
| ) |
| AcResult acDevicePeriodicBoundcondStep | ( | const Device | device, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| const int3 | start, | ||
| const int3 | end | ||
| ) |
! printf(" Total const mem: %ld KiB\n", props.totalConstMem / (1024)); ! printf(" Shared mem per block: %ld KiB\n", props.sharedMemPerBlock / (1024));
| AcResult acDeviceReduceScal | ( | const Device | device, |
| const Stream | stream, | ||
| const ReductionType | rtype, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| AcReal * | result | ||
| ) |
| AcResult acDeviceReduceVec | ( | const Device | device, |
| const Stream | stream_type, | ||
| const ReductionType | rtype, | ||
| const VertexBufferHandle | vtxbuf0, | ||
| const VertexBufferHandle | vtxbuf1, | ||
| const VertexBufferHandle | vtxbuf2, | ||
| AcReal * | result | ||
| ) |
| AcResult acDeviceRunMPITest | ( | void | ) |
| AcResult acDeviceStoreMeshWithOffset | ( | const Device | device, |
| const Stream | stream, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices, | ||
| AcMesh * | host_mesh | ||
| ) |
Deprecated
| AcResult acDeviceStoreVertexBuffer | ( | const Device | device, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| AcMesh * | host_mesh | ||
| ) |
| AcResult acDeviceStoreVertexBufferWithOffset | ( | const Device | device, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices, | ||
| AcMesh * | host_mesh | ||
| ) |
| AcResult acDeviceTransferMeshWithOffset | ( | const Device | src_device, |
| const Stream | stream, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices, | ||
| Device * | dst_device | ||
| ) |
Deprecated
| AcResult acDeviceTransferVertexBuffer | ( | const Device | src_device, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| Device | dst_device | ||
| ) |
| AcResult acDeviceTransferVertexBufferWithOffset | ( | const Device | src_device, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices, | ||
| Device | dst_device | ||
| ) |
| Node acGetNode | ( | void | ) |
| int acGetNumDevicesPerNode | ( | void | ) |
| AcResult acInit | ( | const AcMeshInfo | mesh_info | ) |
Allocates all memory and initializes the devices visible to the caller. Should be called before any other function in this interface.
Performs Runge-Kutta 3 integration. Note: Boundary conditions are not applied after the final substep and the user is responsible for calling acBoundcondStep before reading the data.
Will potentially be deprecated in later versions. Added only to fix backwards compatibility with PC for now.
| AcResult acIntegrateStepWithOffset | ( | const int | isubstep, |
| const AcReal | dt, | ||
| const int3 | start, | ||
| const int3 | end | ||
| ) |
| AcResult acLoadDeviceConstant | ( | const AcRealParam | param, |
| const AcReal | value | ||
| ) |
Loads a constant to the memories of the devices visible to the caller
| AcResult acNodeCreate | ( | const int | id, |
| const AcMeshInfo | node_config, | ||
| Node * | node | ||
| ) |
Initializes all devices on the current node.
Devices on the node are configured based on the contents of AcMesh.
Usage example:
Resets all devices on the current node.
| AcResult acNodeIntegrateSubstep | ( | const Node | node, |
| const Stream | stream, | ||
| const int | step_number, | ||
| const int3 | start, | ||
| const int3 | end, | ||
| const AcReal | dt | ||
| ) |
| AcResult acNodeLoadConstant | ( | const Node | node, |
| const Stream | stream, | ||
| const AcRealParam | param, | ||
| const AcReal | value | ||
| ) |
| AcResult acNodeLoadMeshWithOffset | ( | const Node | node, |
| const Stream | stream, | ||
| const AcMesh | host_mesh, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices | ||
| ) |
| AcResult acNodeLoadVertexBuffer | ( | const Node | node, |
| const Stream | stream, | ||
| const AcMesh | host_mesh, | ||
| const VertexBufferHandle | vtxbuf_handle | ||
| ) |
Deprecated ?
| AcResult acNodeLoadVertexBufferWithOffset | ( | const Node | node, |
| const Stream | stream, | ||
| const AcMesh | host_mesh, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices | ||
| ) |
Deprecated ? Might be useful though if the user wants to load only one vtxbuf. But in this case the user should supply a AcReal* instead of vtxbuf_handle
| AcResult acNodePeriodicBoundcondStep | ( | const Node | node, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle | ||
| ) |
Prints information about the devices available on the current node.
Requires that Node has been initialized with @See acNodeCreate().
| AcResult acNodeQueryDeviceConfiguration | ( | const Node | node, |
| DeviceConfiguration * | config | ||
| ) |
| AcResult acNodeReduceScal | ( | const Node | node, |
| const Stream | stream, | ||
| const ReductionType | rtype, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| AcReal * | result | ||
| ) |
| AcResult acNodeReduceVec | ( | const Node | node, |
| const Stream | stream_type, | ||
| const ReductionType | rtype, | ||
| const VertexBufferHandle | vtxbuf0, | ||
| const VertexBufferHandle | vtxbuf1, | ||
| const VertexBufferHandle | vtxbuf2, | ||
| AcReal * | result | ||
| ) |
| AcResult acNodeStoreMeshWithOffset | ( | const Node | node, |
| const Stream | stream, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices, | ||
| AcMesh * | host_mesh | ||
| ) |
| AcResult acNodeStoreVertexBuffer | ( | const Node | node, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| AcMesh * | host_mesh | ||
| ) |
Deprecated ?
| AcResult acNodeStoreVertexBufferWithOffset | ( | const Node | node, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| const int3 | src, | ||
| const int3 | dst, | ||
| const int | num_vertices, | ||
| AcMesh * | host_mesh | ||
| ) |
Deprecated ?
| AcResult acNodeSynchronizeVertexBuffer | ( | const Node | node, |
| const Stream | stream, | ||
| const VertexBufferHandle | vtxbuf_handle | ||
| ) |
Deprecated ?
| AcResult acQuit | ( | void | ) |
Frees all GPU allocations and resets all devices in the node. Should be called at exit.
| AcReal acReduceScal | ( | const ReductionType | rtype, |
| const VertexBufferHandle | vtxbuf_handle | ||
| ) |
Does a scalar reduction with the data stored in some vertex buffer
| AcReal acReduceVec | ( | const ReductionType | rtype, |
| const VertexBufferHandle | a, | ||
| const VertexBufferHandle | b, | ||
| const VertexBufferHandle | c | ||
| ) |
Does a vector reduction with vertex buffers where the vector components are (a, b, c)
Stores the AcMesh distributed among the devices visible to the caller back to the host
Stores a subset of the mesh stored across the devices visible to the caller back to host memory.
| AcResult acSynchronize | ( | void | ) |
| AcResult acSynchronizeMesh | ( | void | ) |