Multinode MPI implementation should be done later in its own branch. The focus of this branch is to revise the node and device layers. Commented out references to the Grid layer.
This commit is contained in:
@@ -25,9 +25,10 @@ extern "C" {
|
|||||||
#include "astaroth_defines.h"
|
#include "astaroth_defines.h"
|
||||||
|
|
||||||
#include "astaroth_device.h"
|
#include "astaroth_device.h"
|
||||||
#include "astaroth_grid.h"
|
|
||||||
#include "astaroth_node.h"
|
#include "astaroth_node.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include "astaroth_grid.h"
|
||||||
#define acInit(x) acGridInit(x)
|
#define acInit(x) acGridInit(x)
|
||||||
#define acQuit() acGridQuit()
|
#define acQuit() acGridQuit()
|
||||||
#define acLoad(x) acGridLoadMesh(STREAM_DEFAULT, x)
|
#define acLoad(x) acGridLoadMesh(STREAM_DEFAULT, x)
|
||||||
@@ -38,6 +39,28 @@ extern "C" {
|
|||||||
#define acStore(x) acGridStoreMesh(STREAM_DEFAULT, x)
|
#define acStore(x) acGridStoreMesh(STREAM_DEFAULT, x)
|
||||||
#define acSynchronizeStream(x) acGridSynchronizeStream(x)
|
#define acSynchronizeStream(x) acGridSynchronizeStream(x)
|
||||||
#define acLoadDeviceConstant(x, y) acGridLoadConstant(STREAM_DEFAULT, x, y)
|
#define acLoadDeviceConstant(x, y) acGridLoadConstant(STREAM_DEFAULT, x, y)
|
||||||
|
*/
|
||||||
|
|
||||||
|
AcResult acInit(const AcMeshInfo mesh_info);
|
||||||
|
|
||||||
|
AcResult acQuit(void);
|
||||||
|
|
||||||
|
AcResult acSynchronizeStream(const Stream stream);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
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"
|
||||||
|
#include "astaroth.h"
|
||||||
|
|
||||||
#define AC_GEN_STR(X) #X
|
#define AC_GEN_STR(X) #X
|
||||||
const char* intparam_names[] = {AC_FOR_BUILTIN_INT_PARAM_TYPES(AC_GEN_STR) //
|
const char* intparam_names[] = {AC_FOR_BUILTIN_INT_PARAM_TYPES(AC_GEN_STR) //
|
||||||
@@ -29,3 +30,71 @@ const char* real3param_names[] = {AC_FOR_BUILTIN_REAL3_PARAM_TYPES(AC_GEN_STR) /
|
|||||||
AC_FOR_USER_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)};
|
const char* vtxbuf_names[] = {AC_FOR_VTXBUF_HANDLES(AC_GEN_STR)};
|
||||||
#undef AC_GEN_STR
|
#undef AC_GEN_STR
|
||||||
|
|
||||||
|
static const int num_nodes = 1;
|
||||||
|
static Node nodes[num_nodes];
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acInit(const AcMeshInfo mesh_info)
|
||||||
|
{
|
||||||
|
return acNodeCreate(0, mesh_info, &nodes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acQuit(void)
|
||||||
|
{
|
||||||
|
return acNodeDestroy(nodes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acSynchronizeStream(const Stream stream)
|
||||||
|
{
|
||||||
|
return acNodeSynchronizeStream(nodes[0], stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acLoadDeviceConstant(const AcRealParam param, const AcReal value)
|
||||||
|
{
|
||||||
|
return acNodeLoadConstant(nodes[0], STREAM_DEFAULT, param, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acLoad(const AcMesh host_mesh)
|
||||||
|
{
|
||||||
|
return acNodeLoadMesh(nodes[0], STREAM_DEFAULT, host_mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acStore(AcMesh* host_mesh)
|
||||||
|
{
|
||||||
|
return acNodeStoreMesh(nodes[0], STREAM_DEFAULT, host_mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acIntegrate(const AcReal dt)
|
||||||
|
{
|
||||||
|
return acNodeIntegrate(nodes[0], dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acBoundcondStep(void)
|
||||||
|
{
|
||||||
|
return acNodePeriodicBoundconds(nodes[0], STREAM_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
AcReal
|
||||||
|
acReduceScal(const ReductionType rtype, const VertexBufferHandle vtxbuf_handle)
|
||||||
|
{
|
||||||
|
AcReal result;
|
||||||
|
acNodeReduceScal(nodes[0], STREAM_DEFAULT, rtype, vtxbuf_handle, &result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
AcReal
|
||||||
|
acReduceVec(const ReductionType rtype, const VertexBufferHandle a, const VertexBufferHandle b,
|
||||||
|
const VertexBufferHandle c)
|
||||||
|
{
|
||||||
|
AcReal result;
|
||||||
|
acNodeReduceVec(nodes[0], STREAM_DEFAULT, rtype, a, b, c, &result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@@ -30,6 +30,7 @@ acGridInit(const AcMeshInfo node_config)
|
|||||||
{
|
{
|
||||||
acNodeCreate(0, node_config, &nodes[0]);
|
acNodeCreate(0, node_config, &nodes[0]);
|
||||||
++num_nodes;
|
++num_nodes;
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ acGridQuit(void)
|
|||||||
{
|
{
|
||||||
acNodeDestroy(nodes[0]);
|
acNodeDestroy(nodes[0]);
|
||||||
--num_nodes;
|
--num_nodes;
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +48,10 @@ acGridQuit(void)
|
|||||||
AcResult
|
AcResult
|
||||||
acGridSynchronizeStream(const Stream stream)
|
acGridSynchronizeStream(const Stream stream)
|
||||||
{
|
{
|
||||||
WARNING("Not implemented");
|
for (int i = 0; i < num_nodes; ++i) {
|
||||||
|
acNodeSynchronizeStream(nodes[i], stream);
|
||||||
|
}
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +59,10 @@ acGridSynchronizeStream(const Stream stream)
|
|||||||
AcResult
|
AcResult
|
||||||
acGridSwapBuffers(void)
|
acGridSwapBuffers(void)
|
||||||
{
|
{
|
||||||
WARNING("Not implemented");
|
for (int i = 0; i < num_nodes; ++i) {
|
||||||
|
acNodeSwapBuffers(nodes[i]);
|
||||||
|
}
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +70,10 @@ acGridSwapBuffers(void)
|
|||||||
AcResult
|
AcResult
|
||||||
acGridLoadConstant(const Stream stream, const AcRealParam param, const AcReal value)
|
acGridLoadConstant(const Stream stream, const AcRealParam param, const AcReal value)
|
||||||
{
|
{
|
||||||
WARNING("Not implemented");
|
for (int i = 0; i < num_nodes; ++i) {
|
||||||
|
acNodeLoadConstant(node, stream, param, value);
|
||||||
|
}
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +83,10 @@ acGridLoadVertexBufferWithOffset(const Stream stream, const AcMesh host_mesh,
|
|||||||
const VertexBufferHandle vtxbuf_handle, const int3 src,
|
const VertexBufferHandle vtxbuf_handle, const int3 src,
|
||||||
const int3 dst, const int num_vertices)
|
const int3 dst, const int num_vertices)
|
||||||
{
|
{
|
||||||
WARNING("Not implemented");
|
for (int i = 0; i < num_nodes; ++i) {
|
||||||
|
acNodeLoadVertexBufferWithOffset(node, stream, host_mesh, vtxbuf_handle)
|
||||||
|
}
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +95,10 @@ AcResult
|
|||||||
acGridLoadMeshWithOffset(const Stream stream, const AcMesh host_mesh, const int3 src,
|
acGridLoadMeshWithOffset(const Stream stream, const AcMesh host_mesh, const int3 src,
|
||||||
const int3 dst, const int num_vertices)
|
const int3 dst, const int num_vertices)
|
||||||
{
|
{
|
||||||
WARNING("Not implemented");
|
for (int i = 0; i < num_nodes; ++i) {
|
||||||
|
acNodeLoadMeshWithOffset(nodes[i], stream, host_mesh, src, dst, num_vertices);
|
||||||
|
}
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +107,10 @@ AcResult
|
|||||||
acGridLoadVertexBuffer(const Stream stream, const AcMesh host_mesh,
|
acGridLoadVertexBuffer(const Stream stream, const AcMesh host_mesh,
|
||||||
const VertexBufferHandle vtxbuf_handle)
|
const VertexBufferHandle vtxbuf_handle)
|
||||||
{
|
{
|
||||||
WARNING("Not implemented");
|
for (int i = 0; i < num_nodes; ++i) {
|
||||||
|
acNodeLoadVertexBuffer(node, stream, host_mesh, vtxbuf_handle);
|
||||||
|
}
|
||||||
|
WARNING("Proper multinode not yet implemented");
|
||||||
return AC_FAILURE;
|
return AC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user