Removed astaroth_utils from astaroth_core dependencies
This commit is contained in:
@@ -562,6 +562,20 @@ AcResult acDeviceReduceVec(const Device device, const Stream stream_type, const
|
||||
/** */
|
||||
AcResult acDeviceRunMPITest(void);
|
||||
|
||||
/*
|
||||
* =============================================================================
|
||||
* Helper functions
|
||||
* =============================================================================
|
||||
*/
|
||||
/** Updates the built-in parameters based on nx, ny and nz */
|
||||
AcResult acUpdateBuiltinParams(AcMeshInfo* config);
|
||||
|
||||
/** Creates a mesh stored in host memory */
|
||||
AcResult acMeshCreate(const AcMeshInfo mesh_info, AcMesh* mesh);
|
||||
|
||||
/** Destroys a mesh stored in host memory */
|
||||
AcResult acMeshDestroy(AcMesh* mesh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
@@ -70,20 +70,16 @@ bool printErrorToScreen(const Error error);
|
||||
/** Loads data from the config file */
|
||||
AcResult acLoadConfig(const char* config_path, AcMeshInfo* config);
|
||||
|
||||
/** Updates the built-in parameters based on nx, ny and nz */
|
||||
AcResult acUpdateBuiltinParams(AcMeshInfo* config);
|
||||
/** */
|
||||
AcScalReductionTestCase acCreateScalReductionTestCase(const char* label,
|
||||
const VertexBufferHandle vtxbuf,
|
||||
const ReductionType rtype);
|
||||
|
||||
/** */
|
||||
AcResult acMeshCreate(const AcMeshInfo mesh_info, AcMesh* mesh);
|
||||
|
||||
/** */
|
||||
AcResult acMeshDestroy(AcMesh* mesh);
|
||||
|
||||
/** */
|
||||
AcScalReductionTestCase acCreateScalReductionTestCase(const char* label, const VertexBufferHandle vtxbuf, const ReductionType rtype);
|
||||
|
||||
/** */
|
||||
AcVecReductionTestCase acCreateVecReductionTestCase(const char* label, const VertexBufferHandle a, const VertexBufferHandle b, const VertexBufferHandle c, const ReductionType rtype);
|
||||
AcVecReductionTestCase acCreateVecReductionTestCase(const char* label, const VertexBufferHandle a,
|
||||
const VertexBufferHandle b,
|
||||
const VertexBufferHandle c,
|
||||
const ReductionType rtype);
|
||||
|
||||
/** */
|
||||
AcResult acMeshSet(const AcReal value, AcMesh* mesh);
|
||||
@@ -104,16 +100,19 @@ AcResult acModelIntegrateStep(AcMesh mesh, const AcReal dt);
|
||||
AcReal acModelReduceScal(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a);
|
||||
|
||||
/** TODO */
|
||||
AcReal acModelReduceVec(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a, const VertexBufferHandle b, const VertexBufferHandle c);
|
||||
AcReal acModelReduceVec(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a,
|
||||
const VertexBufferHandle b, const VertexBufferHandle c);
|
||||
|
||||
/** */
|
||||
AcResult acVerifyMesh(const AcMesh model, const AcMesh candidate);
|
||||
|
||||
/** */
|
||||
AcResult acVerifyScalReductions(const AcMesh model, const AcScalReductionTestCase* testCases, const size_t numCases);
|
||||
AcResult acVerifyScalReductions(const AcMesh model, const AcScalReductionTestCase* testCases,
|
||||
const size_t numCases);
|
||||
|
||||
/** */
|
||||
AcResult acVerifyVecReductions(const AcMesh model, const AcVecReductionTestCase* testCases, const size_t numCases);
|
||||
AcResult acVerifyVecReductions(const AcMesh model, const AcVecReductionTestCase* testCases,
|
||||
const size_t numCases);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
@@ -2,7 +2,7 @@ find_package(CUDAToolkit)
|
||||
|
||||
## Astaroth Core
|
||||
add_library(astaroth_core STATIC device.cc node.cc astaroth.cc astaroth_fortran.cc)
|
||||
target_link_libraries(astaroth_core astaroth_utils astaroth_kernels CUDA::cudart CUDA::cuda_driver)
|
||||
target_link_libraries(astaroth_core astaroth_kernels CUDA::cudart CUDA::cuda_driver)
|
||||
|
||||
## Options
|
||||
if (MPI_ENABLED)
|
||||
|
@@ -158,3 +158,65 @@ acGetNode(void)
|
||||
ERRCHK_ALWAYS(num_nodes > 0);
|
||||
return nodes[0];
|
||||
}
|
||||
|
||||
AcResult
|
||||
acUpdateBuiltinParams(AcMeshInfo* config)
|
||||
{
|
||||
config->int_params[AC_mx] = config->int_params[AC_nx] + STENCIL_ORDER;
|
||||
///////////// PAD TEST
|
||||
// config->int_params[AC_mx] = config->int_params[AC_nx] + STENCIL_ORDER + PAD_SIZE;
|
||||
///////////// PAD TEST
|
||||
config->int_params[AC_my] = config->int_params[AC_ny] + STENCIL_ORDER;
|
||||
config->int_params[AC_mz] = config->int_params[AC_nz] + STENCIL_ORDER;
|
||||
|
||||
// Bounds for the computational domain, i.e. nx_min <= i < nx_max
|
||||
config->int_params[AC_nx_min] = STENCIL_ORDER / 2;
|
||||
config->int_params[AC_nx_max] = config->int_params[AC_nx_min] + config->int_params[AC_nx];
|
||||
config->int_params[AC_ny_min] = STENCIL_ORDER / 2;
|
||||
config->int_params[AC_ny_max] = config->int_params[AC_ny] + STENCIL_ORDER / 2;
|
||||
config->int_params[AC_nz_min] = STENCIL_ORDER / 2;
|
||||
config->int_params[AC_nz_max] = config->int_params[AC_nz] + STENCIL_ORDER / 2;
|
||||
|
||||
// These do not have to be defined by empty projects any more.
|
||||
// These should be set only if stdderiv.h is included
|
||||
#ifdef AC_dsx
|
||||
config->real_params[AC_inv_dsx] = (AcReal)(1.) / config->real_params[AC_dsx];
|
||||
#endif
|
||||
#ifdef AC_dsy
|
||||
config->real_params[AC_inv_dsy] = (AcReal)(1.) / config->real_params[AC_dsy];
|
||||
#endif
|
||||
#ifdef AC_dsz
|
||||
config->real_params[AC_inv_dsz] = (AcReal)(1.) / config->real_params[AC_dsz];
|
||||
#endif
|
||||
|
||||
/* Additional helper params */
|
||||
// Int helpers
|
||||
config->int_params[AC_mxy] = config->int_params[AC_mx] * config->int_params[AC_my];
|
||||
config->int_params[AC_nxy] = config->int_params[AC_nx] * config->int_params[AC_ny];
|
||||
config->int_params[AC_nxyz] = config->int_params[AC_nxy] * config->int_params[AC_nz];
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshCreate(const AcMeshInfo info, AcMesh* mesh)
|
||||
{
|
||||
mesh->info = info;
|
||||
|
||||
const size_t bytes = acVertexBufferSizeBytes(mesh->info);
|
||||
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) {
|
||||
mesh->vertex_buffer[w] = (AcReal*)malloc(bytes);
|
||||
ERRCHK_ALWAYS(mesh->vertex_buffer[w]);
|
||||
}
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshDestroy(AcMesh* mesh)
|
||||
{
|
||||
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
|
||||
free(mesh->vertex_buffer[w]);
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#include "astaroth_fortran.h"
|
||||
|
||||
#include "astaroth.h"
|
||||
#include "astaroth_utils.h"
|
||||
#include "errchk.h"
|
||||
|
||||
/**
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "astaroth_utils.h"
|
||||
#include "errchk.h"
|
||||
#include "math_utils.h"
|
||||
#include "timer_hires.h"
|
||||
|
@@ -74,45 +74,6 @@ parse_config(const char* path, AcMeshInfo* config)
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
AcResult
|
||||
acUpdateBuiltinParams(AcMeshInfo* config)
|
||||
{
|
||||
config->int_params[AC_mx] = config->int_params[AC_nx] + STENCIL_ORDER;
|
||||
///////////// PAD TEST
|
||||
// config->int_params[AC_mx] = config->int_params[AC_nx] + STENCIL_ORDER + PAD_SIZE;
|
||||
///////////// PAD TEST
|
||||
config->int_params[AC_my] = config->int_params[AC_ny] + STENCIL_ORDER;
|
||||
config->int_params[AC_mz] = config->int_params[AC_nz] + STENCIL_ORDER;
|
||||
|
||||
// Bounds for the computational domain, i.e. nx_min <= i < nx_max
|
||||
config->int_params[AC_nx_min] = STENCIL_ORDER / 2;
|
||||
config->int_params[AC_nx_max] = config->int_params[AC_nx_min] + config->int_params[AC_nx];
|
||||
config->int_params[AC_ny_min] = STENCIL_ORDER / 2;
|
||||
config->int_params[AC_ny_max] = config->int_params[AC_ny] + STENCIL_ORDER / 2;
|
||||
config->int_params[AC_nz_min] = STENCIL_ORDER / 2;
|
||||
config->int_params[AC_nz_max] = config->int_params[AC_nz] + STENCIL_ORDER / 2;
|
||||
|
||||
// These do not have to be defined by empty projects any more.
|
||||
// These should be set only if stdderiv.h is included
|
||||
#ifdef AC_dsx
|
||||
config->real_params[AC_inv_dsx] = (AcReal)(1.) / config->real_params[AC_dsx];
|
||||
#endif
|
||||
#ifdef AC_dsy
|
||||
config->real_params[AC_inv_dsy] = (AcReal)(1.) / config->real_params[AC_dsy];
|
||||
#endif
|
||||
#ifdef AC_dsz
|
||||
config->real_params[AC_inv_dsz] = (AcReal)(1.) / config->real_params[AC_dsz];
|
||||
#endif
|
||||
|
||||
/* Additional helper params */
|
||||
// Int helpers
|
||||
config->int_params[AC_mxy] = config->int_params[AC_mx] * config->int_params[AC_my];
|
||||
config->int_params[AC_nxy] = config->int_params[AC_nx] * config->int_params[AC_ny];
|
||||
config->int_params[AC_nxyz] = config->int_params[AC_nxy] * config->int_params[AC_nz];
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Loads data from astaroth.conf into a config struct.
|
||||
\return AC_SUCCESS on success, AC_FAILURE if there are potentially uninitialized values.
|
||||
|
@@ -20,29 +20,6 @@
|
||||
|
||||
#include "errchk.h"
|
||||
|
||||
AcResult
|
||||
acMeshCreate(const AcMeshInfo info, AcMesh* mesh)
|
||||
{
|
||||
mesh->info = info;
|
||||
|
||||
const size_t bytes = acVertexBufferSizeBytes(mesh->info);
|
||||
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) {
|
||||
mesh->vertex_buffer[w] = malloc(bytes);
|
||||
ERRCHK_ALWAYS(mesh->vertex_buffer[w]);
|
||||
}
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshDestroy(AcMesh* mesh)
|
||||
{
|
||||
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
|
||||
free(mesh->vertex_buffer[w]);
|
||||
|
||||
return AC_SUCCESS;
|
||||
}
|
||||
|
||||
AcResult
|
||||
acMeshSet(const AcReal value, AcMesh* mesh)
|
||||
{
|
||||
|
Reference in New Issue
Block a user