Dummy implementation of the Grid interface
This commit is contained in:
@@ -28,6 +28,17 @@ extern "C" {
|
|||||||
#include "astaroth_grid.h"
|
#include "astaroth_grid.h"
|
||||||
#include "astaroth_node.h"
|
#include "astaroth_node.h"
|
||||||
|
|
||||||
|
#define acInit(x) acGridInit(x)
|
||||||
|
#define acQuit() acGridQuit()
|
||||||
|
#define acLoad(x) acGridLoadMesh(STREAM_DEFAULT, x)
|
||||||
|
#define acReduceScal(x, y) acGridReduceScal(STREAM_DEFAULT, x, y)
|
||||||
|
#define acReduceVec(x, y, z, w) acGridReduceVec(STREAM_DEFAULT, x, y, z, w)
|
||||||
|
#define acBoundcondStep() acGridPeriodicBoundcondStep(STREAM_DEFAULT)
|
||||||
|
#define acIntegrate(x) acGridIntegrateStep(STREAM_DEFAULT, x)
|
||||||
|
#define acStore(x) acGridStoreMesh(STREAM_DEFAULT, x)
|
||||||
|
#define acSynchronizeStream(x) acGridSynchronizeStream(x)
|
||||||
|
#define acLoadDeviceConstant(x, y) acGridLoadConstant(STREAM_DEFAULT, x, y)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -105,7 +105,7 @@ typedef enum {
|
|||||||
} ReductionType;
|
} ReductionType;
|
||||||
|
|
||||||
typedef enum { STREAM_DEFAULT, NUM_STREAM_TYPES } Stream;
|
typedef enum { STREAM_DEFAULT, NUM_STREAM_TYPES } Stream;
|
||||||
#define STREAM_ALL (-1)
|
#define STREAM_ALL (NUM_STREAM_TYPES)
|
||||||
|
|
||||||
#define AC_GEN_ID(X) X
|
#define AC_GEN_ID(X) X
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@@ -31,7 +31,7 @@ AcResult acGridInit(const AcMeshInfo node_config);
|
|||||||
AcResult acGridQuit(void);
|
AcResult acGridQuit(void);
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridSynchronize(void);
|
AcResult acGridSynchronizeStream(const Stream stream);
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridSwapBuffers(void);
|
AcResult acGridSwapBuffers(void);
|
||||||
@@ -72,34 +72,27 @@ AcResult acGridStoreVertexBuffer(const Stream stream, const VertexBufferHandle v
|
|||||||
/** */
|
/** */
|
||||||
AcResult acGridStoreMesh(const Stream stream, AcMesh* host_mesh);
|
AcResult acGridStoreMesh(const Stream stream, AcMesh* host_mesh);
|
||||||
|
|
||||||
/** */
|
|
||||||
AcResult acGridTransferVertexBufferWithOffset(const Stream stream,
|
|
||||||
const VertexBufferHandle vtxbuf_handle,
|
|
||||||
const int3 src, const int3 dst,
|
|
||||||
const int num_vertices);
|
|
||||||
|
|
||||||
/** */
|
|
||||||
AcResult acGridTransferMeshWithOffset(const Stream stream, const int3 src, const int3 dst,
|
|
||||||
const int num_vertices);
|
|
||||||
|
|
||||||
/** */
|
|
||||||
AcResult acGridTransferVertexBuffer(const Stream stream, const VertexBufferHandle vtxbuf_handle);
|
|
||||||
|
|
||||||
/** */
|
|
||||||
AcResult acGridTransferMesh(const Stream stream);
|
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridIntegrateSubstep(const Stream stream, const int step_number, const int3 start,
|
AcResult acGridIntegrateSubstep(const Stream stream, const int step_number, const int3 start,
|
||||||
const int3 end, const AcReal dt);
|
const int3 end, const AcReal dt);
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridPeriodicBoundcondStep(const Stream stream, const int3 start, const int3 end);
|
AcResult acGridIntegrateStep(const Stream stream, const AcReal dt);
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridReduceScal(const Stream stream, const ReductionType rtype,
|
AcResult acGridPeriodicBoundcondStep(const Stream stream);
|
||||||
const VertexBufferHandle vtxbuf_handle, AcReal* result);
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridReduceVec(const Stream stream, const ReductionType rtype,
|
/* acGridReduceScal(const Stream stream, const ReductionType rtype,
|
||||||
|
const VertexBufferHandle vtxbuf_handle, AcReal* result); */
|
||||||
|
AcReal acGridReduceScal(const Stream stream, const ReductionType rtype,
|
||||||
|
const VertexBufferHandle vtxbuf_handle);
|
||||||
|
/** */
|
||||||
|
/*AcResult acGridReduceVec(const Stream stream, const ReductionType rtype,
|
||||||
const VertexBufferHandle vec0, const VertexBufferHandle vec1,
|
const VertexBufferHandle vec0, const VertexBufferHandle vec1,
|
||||||
const VertexBufferHandle vec2, AcReal* result);
|
const VertexBufferHandle vec2, AcReal* result);*/
|
||||||
|
AcReal acGridReduceVec(const Stream stream, const ReductionType rtype,
|
||||||
|
const VertexBufferHandle vec0, const VertexBufferHandle vec1,
|
||||||
|
const VertexBufferHandle vec2);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
@@ -17,3 +17,15 @@
|
|||||||
along with Astaroth. If not, see <http://www.gnu.org/licenses/>.
|
along with Astaroth. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "astaroth_defines.h"
|
#include "astaroth_defines.h"
|
||||||
|
|
||||||
|
#define AC_GEN_STR(X) #X
|
||||||
|
const char* intparam_names[] = {AC_FOR_BUILTIN_INT_PARAM_TYPES(AC_GEN_STR) //
|
||||||
|
AC_FOR_USER_INT_PARAM_TYPES(AC_GEN_STR)};
|
||||||
|
const char* int3param_names[] = {AC_FOR_BUILTIN_INT3_PARAM_TYPES(AC_GEN_STR) //
|
||||||
|
AC_FOR_USER_INT3_PARAM_TYPES(AC_GEN_STR)};
|
||||||
|
const char* realparam_names[] = {AC_FOR_BUILTIN_REAL_PARAM_TYPES(AC_GEN_STR) //
|
||||||
|
AC_FOR_USER_REAL_PARAM_TYPES(AC_GEN_STR)};
|
||||||
|
const char* real3param_names[] = {AC_FOR_BUILTIN_REAL3_PARAM_TYPES(AC_GEN_STR) //
|
||||||
|
AC_FOR_USER_REAL3_PARAM_TYPES(AC_GEN_STR)};
|
||||||
|
const char* vtxbuf_names[] = {AC_FOR_VTXBUF_HANDLES(AC_GEN_STR)};
|
||||||
|
#undef AC_GEN_STR
|
||||||
|
169
src/core/grid.cu
169
src/core/grid.cu
@@ -17,3 +17,172 @@
|
|||||||
along with Astaroth. If not, see <http://www.gnu.org/licenses/>.
|
along with Astaroth. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "astaroth_grid.h"
|
#include "astaroth_grid.h"
|
||||||
|
|
||||||
|
#include "astaroth_node.h"
|
||||||
|
|
||||||
|
const size_t MAX_NUM_NODES = 32;
|
||||||
|
size_t num_nodes = 0;
|
||||||
|
static Node nodes[MAX_NUM_NODES];
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridInit(const AcMeshInfo node_config)
|
||||||
|
{
|
||||||
|
acNodeCreate(0, node_config, &nodes[0]);
|
||||||
|
++num_nodes;
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridQuit(void)
|
||||||
|
{
|
||||||
|
acNodeDestroy(nodes[0]);
|
||||||
|
--num_nodes;
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridSynchronizeStream(const Stream stream)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridSwapBuffers(void)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridLoadConstant(const Stream stream, const AcRealParam param, const AcReal value)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridLoadVertexBufferWithOffset(const Stream stream, const AcMesh host_mesh,
|
||||||
|
const VertexBufferHandle vtxbuf_handle, const int3 src,
|
||||||
|
const int3 dst, const int num_vertices)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridLoadMeshWithOffset(const Stream stream, const AcMesh host_mesh, const int3 src,
|
||||||
|
const int3 dst, const int num_vertices)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridLoadVertexBuffer(const Stream stream, const AcMesh host_mesh,
|
||||||
|
const VertexBufferHandle vtxbuf_handle)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridLoadMesh(const Stream stream, const AcMesh host_mesh)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridStoreVertexBufferWithOffset(const Stream stream, const VertexBufferHandle vtxbuf_handle,
|
||||||
|
const int3 src, const int3 dst, const int num_vertices,
|
||||||
|
AcMesh* host_mesh)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridStoreMeshWithOffset(const Stream stream, const int3 src, const int3 dst,
|
||||||
|
const int num_vertices, AcMesh* host_mesh)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridStoreVertexBuffer(const Stream stream, const VertexBufferHandle vtxbuf_handle,
|
||||||
|
AcMesh* host_mesh)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridStoreMesh(const Stream stream, AcMesh* host_mesh)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridIntegrateSubstep(const Stream stream, const int step_number, const int3 start, const int3 end,
|
||||||
|
const AcReal dt)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridIntegrateStep(const Stream stream, const AcReal dt)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridPeriodicBoundcondStep(const Stream stream)
|
||||||
|
{
|
||||||
|
WARNING("Not implemented");
|
||||||
|
return AC_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/** */
|
||||||
|
AcResult acGridReduceScal(const Stream stream, const ReductionType rtype,
|
||||||
|
const VertexBufferHandle vtxbuf_handle, AcReal* result);
|
||||||
|
/** */
|
||||||
|
AcResult acGridReduceVec(const Stream stream, const ReductionType rtype,
|
||||||
|
const VertexBufferHandle vec0, const VertexBufferHandle vec1,
|
||||||
|
const VertexBufferHandle vec2, AcReal* result);
|
||||||
|
#endif
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridReduceScal(const Stream stream, const ReductionType rtype,
|
||||||
|
const VertexBufferHandle vtxbuf_handle, AcReal* result)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridReduceVec(const Stream stream, const ReductionType rtype, const VertexBufferHandle vec0,
|
||||||
|
const VertexBufferHandle vec1, const VertexBufferHandle vec2, AcReal* result)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -22,18 +22,6 @@
|
|||||||
#include "errchk.h"
|
#include "errchk.h"
|
||||||
#include "math_utils.h" // sum for reductions
|
#include "math_utils.h" // sum for reductions
|
||||||
|
|
||||||
#define AC_GEN_STR(X) #X
|
|
||||||
const char* intparam_names[] = {AC_FOR_BUILTIN_INT_PARAM_TYPES(AC_GEN_STR) //
|
|
||||||
AC_FOR_USER_INT_PARAM_TYPES(AC_GEN_STR)};
|
|
||||||
const char* int3param_names[] = {AC_FOR_BUILTIN_INT3_PARAM_TYPES(AC_GEN_STR) //
|
|
||||||
AC_FOR_USER_INT3_PARAM_TYPES(AC_GEN_STR)};
|
|
||||||
const char* realparam_names[] = {AC_FOR_BUILTIN_REAL_PARAM_TYPES(AC_GEN_STR) //
|
|
||||||
AC_FOR_USER_REAL_PARAM_TYPES(AC_GEN_STR)};
|
|
||||||
const char* real3param_names[] = {AC_FOR_BUILTIN_REAL3_PARAM_TYPES(AC_GEN_STR) //
|
|
||||||
AC_FOR_USER_REAL3_PARAM_TYPES(AC_GEN_STR)};
|
|
||||||
const char* vtxbuf_names[] = {AC_FOR_VTXBUF_HANDLES(AC_GEN_STR)};
|
|
||||||
#undef AC_GEN_STR
|
|
||||||
|
|
||||||
static const int MAX_NUM_DEVICES = 32;
|
static const int MAX_NUM_DEVICES = 32;
|
||||||
static Node node = NULL;
|
static Node node = NULL;
|
||||||
|
|
||||||
@@ -482,10 +470,7 @@ acNodeIntegrate(const Node node, const AcReal dt)
|
|||||||
static AcResult
|
static AcResult
|
||||||
local_boundcondstep(const Node node, const StreamType stream, const VertexBufferHandle vtxbuf)
|
local_boundcondstep(const Node node, const StreamType stream, const VertexBufferHandle vtxbuf)
|
||||||
{
|
{
|
||||||
if (num_devices == 1) {
|
if (num_devices > 1) {
|
||||||
acDeviceBoundcondStep(devices[0], stream, vtxbuf, (int3){0, 0, 0}, subgrid.m);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Local boundary conditions
|
// Local boundary conditions
|
||||||
for (int i = 0; i < num_devices; ++i) {
|
for (int i = 0; i < num_devices; ++i) {
|
||||||
const int3 d0 = (int3){0, 0, NGHOST}; // DECOMPOSITION OFFSET HERE
|
const int3 d0 = (int3){0, 0, NGHOST}; // DECOMPOSITION OFFSET HERE
|
||||||
@@ -493,6 +478,9 @@ local_boundcondstep(const Node node, const StreamType stream, const VertexBuffer
|
|||||||
acDeviceBoundcondStep(devices[i], stream, vtxbuf, d0, d1);
|
acDeviceBoundcondStep(devices[i], stream, vtxbuf, d0, d1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
acDeviceBoundcondStep(devices[0], stream, vtxbuf, (int3){0, 0, 0}, subgrid.m);
|
||||||
|
}
|
||||||
return AC_SUCCESS;
|
return AC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,9 +520,12 @@ acNodePeriodicBoundcondStep(const Node node, const Stream stream,
|
|||||||
const VertexBufferHandle vtxbuf_handle)
|
const VertexBufferHandle vtxbuf_handle)
|
||||||
{
|
{
|
||||||
local_boundcondstep(node, stream, vtxbuf_handle);
|
local_boundcondstep(node, stream, vtxbuf_handle);
|
||||||
global_boundcondstep(node, stream, vtxbuf_handle);
|
|
||||||
acNodeSynchronizeVertexBuffer(node, stream, vtxbuf_handle);
|
acNodeSynchronizeVertexBuffer(node, stream, vtxbuf_handle);
|
||||||
|
|
||||||
|
// TODO NOTE GLOBAL BOUNDCONDS NOT DONE HERE IF MORE THAN 1 NODE
|
||||||
|
global_boundcondstep(node, stream, vtxbuf_handle);
|
||||||
|
WARNING("Global boundconds should not be done here with multinode");
|
||||||
|
|
||||||
return AC_SUCCESS;
|
return AC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user