|
Astaroth
3.1
Scalable Multi-GPU Stencil Computations
|
#include "ac_mpi.h"#include "astaroth_device.h"#include "astaroth_helpers.h"#include "func_define.h"Go to the source code of this file.
Data Structures | |
| struct | AcTaskDefinition |
| struct | facet_class_range |
| struct | ParamLoadingInfo |
Typedefs | |
| typedef struct AcTaskGraph | AcTaskGraph |
| typedef struct LoadKernelParamsFunc | LoadKernelParamsFunc |
Enumerations | |
| enum | AccessType { ACCESS_READ , ACCESS_WRITE } |
| enum | AcTaskType { TASKTYPE_NO_OP , TASKTYPE_COMPUTE , TASKTYPE_HALOEXCHANGE , TASKTYPE_BOUNDCOND , TASKTYPE_REDUCE , TASKTYPE_SCAN , TASKTYPE_RAY_UPDATE , TASKTYPE_PERIODIC_RAY } |
Functions | |
| void | ac_MPI_Barrier () |
| int | ac_MPI_Comm_rank () |
| int | ac_MPI_Comm_size () |
| void | ac_MPI_Finalize () |
| AcResult | ac_MPI_Init (void) |
| AcResult | ac_MPI_Init_thread (int thread_level) |
| acAnalysisBCInfo | acAnalysisGetBCInfo (const AcMeshInfo info, const AcKernel bc, const AcBoundary boundary) |
| AcTaskDefinition | acBoundaryCondition (const AcBoundary boundary, AcKernel kernel, Field fields_in[], const size_t num_fields_in, Field fields_out[], const size_t num_fields_out, void(*load_func)(ParamLoadingInfo step_info)) |
| AcTaskDefinition | acBoundaryConditionWithBounds (const AcBoundary boundary, AcKernel kernel, Field fields_in[], const size_t num_fields_in, Field fields_out[], const size_t num_fields_out, const Volume start, const Volume end, const facet_class_range halo_types[], const int3 id, void(*load_func)(ParamLoadingInfo step_info)) |
| AcTaskDefinition | acCompute (const AcKernel kernel, Field fields_in[], const size_t num_fields_in, Field fields_out[], const size_t num_fields_out, Profile profiles_in[], const size_t num_profiles_in, Profile profiles_out[], const size_t num_profiles_out) |
| AcTaskDefinition | acComputeWithParams (const AcKernel kernel, Field fields_in[], const size_t num_fields_in, Field fields_out[], const size_t num_fields_out, Profile profiles_in[], const size_t num_profiles_in, Profile profiles_out[], const size_t num_profiles_out, const Volume start, const Volume dims, const int onion_level, void(*load_func)(ParamLoadingInfo step_info)) |
| AcDSLTaskGraph | acGetComputeStepsBCs (const AcDSLTaskGraph graph) |
| AcTaskGraph * | acGetDSLTaskGraph (const AcDSLTaskGraph) |
| AcTaskGraph * | acGetDSLTaskGraphWithBounds (const AcDSLTaskGraph, const Volume start, const Volume end) |
| AcTaskGraph * | acGetOptimizedDSLTaskGraph (const AcDSLTaskGraph) |
| AcTaskGraph * | acGetOptimizedDSLTaskGraphWithBounds (const AcDSLTaskGraph, const Volume start, const Volume end, const bool no_communication, const AcDSLTaskGraph bc_graph) |
| AcResult | acGridAccessMeshOnDiskSynchronous (const VertexBufferHandle field, const char *dir, const char *label, const AccessType type) |
| AcResult | acGridAccessMeshOnDiskSynchronousCollective (const VertexBufferHandle vtxbuf, const char *dir, const char *label, const AccessType type) |
| AcResult | acGridAccessMeshOnDiskSynchronousDistributed (const VertexBufferHandle vtxbuf, const char *dir, const char *label, const AccessType type) |
| AcTaskGraph * | acGridBuildTaskGraph (const AcTaskDefinition ops[], const size_t n_ops) |
| AcTaskGraph * | acGridBuildTaskGraphWithBounds (const AcTaskDefinition ops[], const size_t n_ops, const Volume start, const Volume end, const bool globally_imposed_bcs) |
| AcResult | acGridClearTaskGraphCache () |
| AcResult | acGridDestroyTaskGraph (AcTaskGraph *graph) |
| AcResult | acGridDiskAccessLaunch (const AccessType type) |
| AcResult | acGridDiskAccessSync (void) |
| AcResult | acGridExecuteTaskGraph (AcTaskGraph *graph, const size_t n_iterations) |
| AcResult | acGridExecuteTaskGraphBase (AcTaskGraph *graph, const size_t n_iterations, const bool include_all) |
| AcResult | acGridFinalizeReduce (AcTaskGraph *graph) |
| AcResult | acGridFinalizeReduceLocal (AcTaskGraph *graph) |
| AcTaskGraph * | acGridGetDefaultTaskGraph () |
| Device | acGridGetDevice (void) |
| AcResult | acGridHaloExchange () |
| AcResult | acGridHaloExchangeFaces () |
| AcResult | acGridInitBase (const AcMesh mesh) |
| bool | acGridInitialized () |
| AcResult | acGridIntegrate (const Stream stream, const AcReal dt) |
| AcResult | acGridLaunchKernel (const Stream stream, const AcKernel kernel, const Volume start, const Volume end) |
| AcResult | acGridLoadInt3Uniform (const Stream stream, const AcInt3Param param, const int3 value) |
| AcResult | acGridLoadIntUniform (const Stream stream, const AcIntParam param, const int value) |
| AcResult | acGridLoadMesh (const Stream stream, const AcMesh host_mesh) |
| AcResult | acGridLoadScalarUniform (const Stream stream, const AcRealParam param, const AcReal value) |
| AcResult | acGridLoadStencil (const Stream stream, const Stencil stencil, const AcReal data[STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH]) |
| AcResult | acGridLoadStencils (const Stream stream, const AcReal data[NUM_STENCILS][STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH]) |
| AcResult | acGridLoadVectorUniform (const Stream stream, const AcReal3Param param, const AcReal3 value) |
| MPI_Comm | acGridMPIComm () |
| AcSubCommunicators | acGridMPISubComms () |
| AcResult | acGridPeriodicBoundconds (const Stream stream) |
| AcResult | acGridQuit (void) |
| AcResult | acGridRandomize (void) |
| AcResult | acGridReadVarfileToMesh (const char *file, const Field fields[], const size_t num_fields, const int3 nn, const int3 rr) |
| AcResult | acGridReduceScal (const Stream stream, const AcReduction reduction, const VertexBufferHandle vtxbuf_handle, AcReal *result) |
| AcResult | acGridReduceVec (const Stream stream, const AcReduction reduction, const VertexBufferHandle vtxbuf0, const VertexBufferHandle vtxbuf1, const VertexBufferHandle vtxbuf2, AcReal *result) |
| AcResult | acGridReduceVecScal (const Stream stream, const AcReduction reduction, const VertexBufferHandle vtxbuf0, const VertexBufferHandle vtxbuf1, const VertexBufferHandle vtxbuf2, const VertexBufferHandle vtxbuf3, AcReal *result) |
| AcResult | acGridReduceXY (const Stream stream, const Field field, const Profile profile, const AcReduction reduction) |
| AcResult | acGridStoreMesh (const Stream stream, AcMesh *host_mesh) |
| AcResult | acGridStoreStencil (const Stream stream, const Stencil stencil, AcReal data[STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH]) |
| AcResult | acGridStoreStencils (const Stream stream, AcReal data[NUM_STENCILS][STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH]) |
| AcResult | acGridSwapBuffers (void) |
| AcResult | acGridSynchronizeStream (const Stream stream) |
| bool | acGridTaskGraphHasPeriodicBoundcondsX (AcTaskGraph *graph) |
| bool | acGridTaskGraphHasPeriodicBoundcondsY (AcTaskGraph *graph) |
| bool | acGridTaskGraphHasPeriodicBoundcondsZ (AcTaskGraph *graph) |
| bool | acGridTaskGraphIsEmpty (AcTaskGraph *graph) |
| AcResult | acGridWriteMeshToDiskLaunch (const char *dir, const char *label) |
| AcResult | acGridWriteSlicesToDiskCollectiveSynchronous (const char *dir, const int step_number, const AcReal simulation_time) |
| AcResult | acGridWriteSlicesToDiskLaunch (const char *dir, const int step_number, const AcReal simulation_time) |
| AcResult | acGridWriteSlicesToDiskSynchronous (const char *dir, const int step_number, const AcReal simulation_time) |
| AcTaskDefinition | acHaloExchange (Field fields[], const size_t num_fields) |
| AcTaskDefinition | acHaloExchangeBoundary (Field fields[], const size_t num_fields, const AcBoundary boundary) |
| AcTaskDefinition | acHaloExchangeWithBounds (Field fields[], const size_t num_fields, const Volume start, const Volume end, const int3 ray_direction, const bool sending, const bool receiving, const AcBoundary boundary, const bool include_boundaries, const facet_class_range halo_types[], const Volume halo_size) |
| AcTaskDefinition | acPeriodicRay (Field fields[], const size_t num_fields, const int3 direction) |
| AcTaskDefinition | acRayUpdate (const AcKernel kernel, const AcBoundary boundary, const int3 ray_direction, Field fields_in[], const size_t num_fields_in, Field fields_out[], const size_t num_fields_out, void(*load_func)(ParamLoadingInfo step_info)) |
| AcTaskDefinition | acScan (Field fields[], const size_t num_fields, const int3 direction) |
| typedef struct AcTaskGraph AcTaskGraph |
TaskGraph is an opaque datatype containing information necessary to execute a set of operations.
| typedef struct LoadKernelParamsFunc LoadKernelParamsFunc |
| enum AccessType |
| enum AcTaskType |
| void ac_MPI_Barrier | ( | ) |
Calls MPI_Barrier on the Astaroth communicator
| int ac_MPI_Comm_rank | ( | ) |
Returns the rank of the Astaroth communicator
| int ac_MPI_Comm_size | ( | ) |
Returns the size of the Astaroth communicator
| void ac_MPI_Finalize | ( | ) |
Destroys the communicator and calls MPI_Finalize
| AcResult ac_MPI_Init | ( | void | ) |
Calls MPI_Init and creates a separate communicator for Astaroth procs with MPI_Comm_split, color = 666 Any program running in the same MPI process space must also call MPI_Comm_split with some color != 666. OTHERWISE this call will hang.
Returns AC_SUCCESS on successfullly initializing MPI and creating a communicator.
Returns AC_FAILURE otherwise.
| AcResult ac_MPI_Init_thread | ( | int | thread_level | ) |
Calls MPI_Init_thread with the provided thread_level and creates a separate communicator for Astaroth procs with MPI_Comm_split, color = 666 Any program running in the same MPI process space must also call MPI_Comm_split with some color != 666. OTHERWISE this call will hang.
Returns AC_SUCCESS on successfullly initializing MPI with the requested thread level and creating a communicator.
Returns AC_FAILURE otherwise.
| acAnalysisBCInfo acAnalysisGetBCInfo | ( | const AcMeshInfo | info, |
| const AcKernel | bc, | ||
| const AcBoundary | boundary ) |
| AcTaskDefinition acBoundaryCondition | ( | const AcBoundary | boundary, |
| AcKernel | kernel, | ||
| Field | fields_in[], | ||
| const size_t | num_fields_in, | ||
| Field | fields_out[], | ||
| const size_t | num_fields_out, | ||
| void(* | load_func )(ParamLoadingInfo step_info) ) |
| AcTaskDefinition acBoundaryConditionWithBounds | ( | const AcBoundary | boundary, |
| AcKernel | kernel, | ||
| Field | fields_in[], | ||
| const size_t | num_fields_in, | ||
| Field | fields_out[], | ||
| const size_t | num_fields_out, | ||
| const Volume | start, | ||
| const Volume | end, | ||
| const facet_class_range | halo_types[], | ||
| const int3 | id, | ||
| void(* | load_func )(ParamLoadingInfo step_info) ) |
| AcTaskDefinition acCompute | ( | const AcKernel | kernel, |
| Field | fields_in[], | ||
| const size_t | num_fields_in, | ||
| Field | fields_out[], | ||
| const size_t | num_fields_out, | ||
| Profile | profiles_in[], | ||
| const size_t | num_profiles_in, | ||
| Profile | profiles_out[], | ||
| const size_t | num_profiles_out ) |
| AcTaskDefinition acComputeWithParams | ( | const AcKernel | kernel, |
| Field | fields_in[], | ||
| const size_t | num_fields_in, | ||
| Field | fields_out[], | ||
| const size_t | num_fields_out, | ||
| Profile | profiles_in[], | ||
| const size_t | num_profiles_in, | ||
| Profile | profiles_out[], | ||
| const size_t | num_profiles_out, | ||
| const Volume | start, | ||
| const Volume | dims, | ||
| const int | onion_level, | ||
| void(* | load_func )(ParamLoadingInfo step_info) ) |
| AcDSLTaskGraph acGetComputeStepsBCs | ( | const AcDSLTaskGraph | graph | ) |
| AcTaskGraph * acGetDSLTaskGraph | ( | const AcDSLTaskGraph | ) |
| AcTaskGraph * acGetDSLTaskGraphWithBounds | ( | const AcDSLTaskGraph | , |
| const Volume | start, | ||
| const Volume | end ) |
| AcTaskGraph * acGetOptimizedDSLTaskGraph | ( | const AcDSLTaskGraph | ) |
| AcTaskGraph * acGetOptimizedDSLTaskGraphWithBounds | ( | const AcDSLTaskGraph | , |
| const Volume | start, | ||
| const Volume | end, | ||
| const bool | no_communication, | ||
| const AcDSLTaskGraph | bc_graph ) |
| AcResult acGridAccessMeshOnDiskSynchronous | ( | const VertexBufferHandle | field, |
| const char * | dir, | ||
| const char * | label, | ||
| const AccessType | type ) |
| AcResult acGridAccessMeshOnDiskSynchronousCollective | ( | const VertexBufferHandle | vtxbuf, |
| const char * | dir, | ||
| const char * | label, | ||
| const AccessType | type ) |
| AcResult acGridAccessMeshOnDiskSynchronousDistributed | ( | const VertexBufferHandle | vtxbuf, |
| const char * | dir, | ||
| const char * | label, | ||
| const AccessType | type ) |
| AcTaskGraph * acGridBuildTaskGraph | ( | const AcTaskDefinition | ops[], |
| const size_t | n_ops ) |
| AcTaskGraph * acGridBuildTaskGraphWithBounds | ( | const AcTaskDefinition | ops[], |
| const size_t | n_ops, | ||
| const Volume | start, | ||
| const Volume | end, | ||
| const bool | globally_imposed_bcs ) |
| AcResult acGridClearTaskGraphCache | ( | ) |
| AcResult acGridDestroyTaskGraph | ( | AcTaskGraph * | graph | ) |
| AcResult acGridDiskAccessLaunch | ( | const AccessType | type | ) |
| AcResult acGridDiskAccessSync | ( | void | ) |
| AcResult acGridExecuteTaskGraph | ( | AcTaskGraph * | graph, |
| const size_t | n_iterations ) |
| AcResult acGridExecuteTaskGraphBase | ( | AcTaskGraph * | graph, |
| const size_t | n_iterations, | ||
| const bool | include_all ) |
| AcResult acGridFinalizeReduce | ( | AcTaskGraph * | graph | ) |
| AcResult acGridFinalizeReduceLocal | ( | AcTaskGraph * | graph | ) |
| AcTaskGraph * acGridGetDefaultTaskGraph | ( | ) |
| Device acGridGetDevice | ( | void | ) |
Get the local device
| AcResult acGridHaloExchange | ( | ) |
| AcResult acGridHaloExchangeFaces | ( | ) |
Halo exchange of the communicated fields, only the faces of the halos (no edges and corners)
Initializes all available devices.
Must compile and run the code with MPI.
Must allocate exactly one process per GPU. And the same number of processes per node as there are GPUs on that node.
Devices in the grid are configured based on the contents of AcMesh.
| bool acGridInitialized | ( | ) |
| AcResult acGridLaunchKernel | ( | const Stream | stream, |
| const AcKernel | kernel, | ||
| const Volume | start, | ||
| const Volume | end ) |
| AcResult acGridLoadScalarUniform | ( | const Stream | stream, |
| const AcRealParam | param, | ||
| const AcReal | value ) |
| AcResult acGridLoadStencil | ( | const Stream | stream, |
| const Stencil | stencil, | ||
| const AcReal | data[STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH] ) |
| AcResult acGridLoadStencils | ( | const Stream | stream, |
| const AcReal | data[NUM_STENCILS][STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH] ) |
| AcResult acGridLoadVectorUniform | ( | const Stream | stream, |
| const AcReal3Param | param, | ||
| const AcReal3 | value ) |
| MPI_Comm acGridMPIComm | ( | ) |
If MPI was initialized with MPI_Init* instead of ac_MPI_Init, this will return MPI_COMM_WORLD
| AcSubCommunicators acGridMPISubComms | ( | ) |
| AcResult acGridQuit | ( | void | ) |
Resets all devices on the current grid.
| AcResult acGridRandomize | ( | void | ) |
Randomizes the local mesh
| AcResult acGridReadVarfileToMesh | ( | const char * | file, |
| const Field | fields[], | ||
| const size_t | num_fields, | ||
| const int3 | nn, | ||
| const int3 | rr ) |
| AcResult acGridReduceScal | ( | const Stream | stream, |
| const AcReduction | reduction, | ||
| const VertexBufferHandle | vtxbuf_handle, | ||
| AcReal * | result ) |
| AcResult acGridReduceVec | ( | const Stream | stream, |
| const AcReduction | reduction, | ||
| const VertexBufferHandle | vtxbuf0, | ||
| const VertexBufferHandle | vtxbuf1, | ||
| const VertexBufferHandle | vtxbuf2, | ||
| AcReal * | result ) |
| AcResult acGridReduceVecScal | ( | const Stream | stream, |
| const AcReduction | reduction, | ||
| const VertexBufferHandle | vtxbuf0, | ||
| const VertexBufferHandle | vtxbuf1, | ||
| const VertexBufferHandle | vtxbuf2, | ||
| const VertexBufferHandle | vtxbuf3, | ||
| AcReal * | result ) |
| AcResult acGridReduceXY | ( | const Stream | stream, |
| const Field | field, | ||
| const Profile | profile, | ||
| const AcReduction | reduction ) |
| AcResult acGridStoreStencil | ( | const Stream | stream, |
| const Stencil | stencil, | ||
| AcReal | data[STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH] ) |
| AcResult acGridStoreStencils | ( | const Stream | stream, |
| AcReal | data[NUM_STENCILS][STENCIL_DEPTH][STENCIL_HEIGHT][STENCIL_WIDTH] ) |
| AcResult acGridSwapBuffers | ( | void | ) |
| bool acGridTaskGraphHasPeriodicBoundcondsX | ( | AcTaskGraph * | graph | ) |
| bool acGridTaskGraphHasPeriodicBoundcondsY | ( | AcTaskGraph * | graph | ) |
| bool acGridTaskGraphHasPeriodicBoundcondsZ | ( | AcTaskGraph * | graph | ) |
| bool acGridTaskGraphIsEmpty | ( | AcTaskGraph * | graph | ) |
| AcResult acGridWriteMeshToDiskLaunch | ( | const char * | dir, |
| const char * | label ) |
| AcResult acGridWriteSlicesToDiskCollectiveSynchronous | ( | const char * | dir, |
| const int | step_number, | ||
| const AcReal | simulation_time ) |
| AcResult acGridWriteSlicesToDiskLaunch | ( | const char * | dir, |
| const int | step_number, | ||
| const AcReal | simulation_time ) |
| AcResult acGridWriteSlicesToDiskSynchronous | ( | const char * | dir, |
| const int | step_number, | ||
| const AcReal | simulation_time ) |
| AcTaskDefinition acHaloExchange | ( | Field | fields[], |
| const size_t | num_fields ) |
| AcTaskDefinition acHaloExchangeBoundary | ( | Field | fields[], |
| const size_t | num_fields, | ||
| const AcBoundary | boundary ) |
| AcTaskDefinition acHaloExchangeWithBounds | ( | Field | fields[], |
| const size_t | num_fields, | ||
| const Volume | start, | ||
| const Volume | end, | ||
| const int3 | ray_direction, | ||
| const bool | sending, | ||
| const bool | receiving, | ||
| const AcBoundary | boundary, | ||
| const bool | include_boundaries, | ||
| const facet_class_range | halo_types[], | ||
| const Volume | halo_size ) |
| AcTaskDefinition acPeriodicRay | ( | Field | fields[], |
| const size_t | num_fields, | ||
| const int3 | direction ) |
| AcTaskDefinition acRayUpdate | ( | const AcKernel | kernel, |
| const AcBoundary | boundary, | ||
| const int3 | ray_direction, | ||
| Field | fields_in[], | ||
| const size_t | num_fields_in, | ||
| Field | fields_out[], | ||
| const size_t | num_fields_out, | ||
| void(* | load_func )(ParamLoadingInfo step_info) ) |
| AcTaskDefinition acScan | ( | Field | fields[], |
| const size_t | num_fields, | ||
| const int3 | direction ) |