Now all host functions start with acHost to avoid confusion on whether the function operates on host or device memory

This commit is contained in:
jpekkila
2020-11-24 21:32:43 +02:00
parent 095f863097
commit bcacc357d3
15 changed files with 78 additions and 77 deletions

View File

@@ -606,7 +606,7 @@ generate_headers(void)
! -*-f90-*- (for emacs) vim:set filetype=fortran: (for vim) ! -*-f90-*- (for emacs) vim:set filetype=fortran: (for vim)
! Utils (see astaroth_fortran.cc for definitions) ! Utils (see astaroth_fortran.cc for definitions)
external acupdatebuiltinparams external achostupdatebuiltinparams
external acgetdevicecount external acgetdevicecount
! Device interface (see astaroth_fortran.cc for definitions) ! Device interface (see astaroth_fortran.cc for definitions)

View File

@@ -45,25 +45,25 @@ typedef struct {
AcResult acLoadConfig(const char* config_path, AcMeshInfo* config); AcResult acLoadConfig(const char* config_path, AcMeshInfo* config);
/** */ /** */
AcResult acVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* mesh); AcResult acHostVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* mesh);
/** */ /** */
AcResult acMeshSet(const AcReal value, AcMesh* mesh); AcResult acHostMeshSet(const AcReal value, AcMesh* mesh);
/** */ /** */
AcResult acMeshApplyPeriodicBounds(AcMesh* mesh); AcResult acHostMeshApplyPeriodicBounds(AcMesh* mesh);
/** */ /** */
AcResult acMeshClear(AcMesh* mesh); AcResult acHostMeshClear(AcMesh* mesh);
/** */ /** */
AcResult acModelIntegrateStep(AcMesh mesh, const AcReal dt); AcResult acHostIntegrateStep(AcMesh mesh, const AcReal dt);
/** */ /** */
AcReal acModelReduceScal(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a); AcReal acHostReduceScal(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a);
/** */ /** */
AcReal acModelReduceVec(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a, AcReal acHostReduceVec(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a,
const VertexBufferHandle b, const VertexBufferHandle c); const VertexBufferHandle b, const VertexBufferHandle c);
Error acGetError(const AcReal model, const AcReal candidate); Error acGetError(const AcReal model, const AcReal candidate);

View File

@@ -98,7 +98,7 @@ main(int argc, char** argv)
info.int_params[AC_nx] = nx; info.int_params[AC_nx] = nx;
info.int_params[AC_ny] = ny; info.int_params[AC_ny] = ny;
info.int_params[AC_nz] = nz; info.int_params[AC_nz] = nz;
acUpdateBuiltinParams(&info); acHostUpdateBuiltinParams(&info);
printf("Benchmark mesh dimensions: (%d, %d, %d)\n", nx, ny, nz); printf("Benchmark mesh dimensions: (%d, %d, %d)\n", nx, ny, nz);
} }
else { else {
@@ -118,8 +118,8 @@ main(int argc, char** argv)
/* /*
AcMesh model, candidate; AcMesh model, candidate;
if (pid == 0) { if (pid == 0) {
acMeshCreate(info, &model); acHostMeshCreate(info, &model);
acMeshCreate(info, &candidate); acHostMeshCreate(info, &candidate);
acMeshRandomize(&model); acMeshRandomize(&model);
acMeshRandomize(&candidate); acMeshRandomize(&candidate);
}*/ }*/
@@ -130,7 +130,7 @@ main(int argc, char** argv)
/* /*
AcMesh model; AcMesh model;
acMeshCreate(info, &model); acHostMeshCreate(info, &model);
acMeshRandomize(&model); acMeshRandomize(&model);
acGridLoadMesh(STREAM_DEFAULT, model); acGridLoadMesh(STREAM_DEFAULT, model);
*/ */
@@ -145,12 +145,12 @@ main(int argc, char** argv)
// Verify // Verify
if (pid == 0) { if (pid == 0) {
acModelIntegrateStep(model, FLT_EPSILON); acHostIntegrateStep(model, FLT_EPSILON);
acMeshApplyPeriodicBounds(&model); acMeshApplyPeriodicBounds(&model);
AcResult retval = acVerifyMesh(model, candidate); AcResult retval = acVerifyMesh(model, candidate);
acMeshDestroy(&model); acHostMeshDestroy(&model);
acMeshDestroy(&candidate); acHostMeshDestroy(&candidate);
if (retval != AC_SUCCESS) { if (retval != AC_SUCCESS) {
fprintf(stderr, "Failures found, benchmark invalid. Skipping\n"); fprintf(stderr, "Failures found, benchmark invalid. Skipping\n");

View File

@@ -31,12 +31,12 @@ main(void)
// Alloc // Alloc
AcMesh model, candidate; AcMesh model, candidate;
acMeshCreate(info, &model); acHostMeshCreate(info, &model);
acMeshCreate(info, &candidate); acHostMeshCreate(info, &candidate);
// Init // Init
acMeshRandomize(&model); acHostMeshRandomize(&model);
acMeshApplyPeriodicBounds(&model); acHostMeshApplyPeriodicBounds(&model);
// Verify that the mesh was loaded and stored correctly // Verify that the mesh was loaded and stored correctly
acInit(info); acInit(info);
@@ -55,8 +55,8 @@ main(void)
// Destroy // Destroy
acQuit(); acQuit();
acMeshDestroy(&model); acHostMeshDestroy(&model);
acMeshDestroy(&candidate); acHostMeshDestroy(&candidate);
puts("cpptest complete."); puts("cpptest complete.");
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@@ -30,12 +30,12 @@ main(void)
// Alloc // Alloc
AcMesh model, candidate; AcMesh model, candidate;
acMeshCreate(info, &model); acHostMeshCreate(info, &model);
acMeshCreate(info, &candidate); acHostMeshCreate(info, &candidate);
// Init // Init
acMeshRandomize(&model); acHostMeshRandomize(&model);
acMeshApplyPeriodicBounds(&model); acHostMeshApplyPeriodicBounds(&model);
// Verify that the mesh was loaded and stored correctly // Verify that the mesh was loaded and stored correctly
acInit(info); acInit(info);
@@ -46,6 +46,7 @@ main(void)
// Attempt to integrate and check max and min // Attempt to integrate and check max and min
printf("Integrating... "); printf("Integrating... ");
acIntegrate(FLT_EPSILON); acIntegrate(FLT_EPSILON);
printf("Done.\nVTXBUF ranges after one integration step:\n"); printf("Done.\nVTXBUF ranges after one integration step:\n");
for (size_t i = 0; i < NUM_VTXBUF_HANDLES; ++i) for (size_t i = 0; i < NUM_VTXBUF_HANDLES; ++i)
printf("\t%-15s... [%.3g, %.3g]\n", vtxbuf_names[i], // printf("\t%-15s... [%.3g, %.3g]\n", vtxbuf_names[i], //
@@ -54,8 +55,8 @@ main(void)
// Destroy // Destroy
acQuit(); acQuit();
acMeshDestroy(&model); acHostMeshDestroy(&model);
acMeshDestroy(&candidate); acHostMeshDestroy(&candidate);
puts("ctest complete."); puts("ctest complete.");
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@@ -14,7 +14,7 @@ program pc
info%int_params(AC_nx + 1) = 128 info%int_params(AC_nx + 1) = 128
info%int_params(AC_ny + 1) = 128 info%int_params(AC_ny + 1) = 128
info%int_params(AC_nz + 1) = 128 info%int_params(AC_nz + 1) = 128
call acupdatebuiltinparams(info) call achostupdatebuiltinparams(info)
call acdevicecreate(0, info, device) call acdevicecreate(0, info, device)
call acdeviceprintinfo(device) call acdeviceprintinfo(device)

View File

@@ -47,8 +47,8 @@ main(void)
AcMesh model, candidate; AcMesh model, candidate;
if (pid == 0) { if (pid == 0) {
acMeshCreate(info, &model); acHostMeshCreate(info, &model);
acMeshCreate(info, &candidate); acHostMeshCreate(info, &candidate);
acMeshRandomize(&model); acMeshRandomize(&model);
acMeshRandomize(&candidate); acMeshRandomize(&candidate);
} }
@@ -73,7 +73,7 @@ main(void)
acGridPeriodicBoundconds(STREAM_DEFAULT); acGridPeriodicBoundconds(STREAM_DEFAULT);
acGridStoreMesh(STREAM_DEFAULT, &candidate); acGridStoreMesh(STREAM_DEFAULT, &candidate);
if (pid == 0) { if (pid == 0) {
acModelIntegrateStep(model, FLT_EPSILON); acHostIntegrateStep(model, FLT_EPSILON);
acMeshApplyPeriodicBounds(&model); acMeshApplyPeriodicBounds(&model);
const AcResult res = acVerifyMesh("Integration", model, candidate); const AcResult res = acVerifyMesh("Integration", model, candidate);
ERRCHK_ALWAYS(res == AC_SUCCESS); ERRCHK_ALWAYS(res == AC_SUCCESS);
@@ -93,10 +93,10 @@ main(void)
AcReal candval; AcReal candval;
acGridReduceScal(STREAM_DEFAULT, (ReductionType)i, v0, &candval); acGridReduceScal(STREAM_DEFAULT, (ReductionType)i, v0, &candval);
if (pid == 0) { if (pid == 0) {
const AcReal modelval = acModelReduceScal(model, (ReductionType)i, v0); const AcReal modelval = acHostReduceScal(model, (ReductionType)i, v0);
Error error = acGetError(modelval, candval); Error error = acGetError(modelval, candval);
error.maximum_magnitude = acModelReduceScal(model, RTYPE_MAX, v0); error.maximum_magnitude = acHostReduceScal(model, RTYPE_MAX, v0);
error.minimum_magnitude = acModelReduceScal(model, RTYPE_MIN, v0); error.minimum_magnitude = acHostReduceScal(model, RTYPE_MIN, v0);
ERRCHK_ALWAYS(acEvalError(rtype_names[i], error)); ERRCHK_ALWAYS(acEvalError(rtype_names[i], error));
} }
} }
@@ -114,17 +114,17 @@ main(void)
AcReal candval; AcReal candval;
acGridReduceVec(STREAM_DEFAULT, (ReductionType)i, v0, v1, v2, &candval); acGridReduceVec(STREAM_DEFAULT, (ReductionType)i, v0, v1, v2, &candval);
if (pid == 0) { if (pid == 0) {
const AcReal modelval = acModelReduceVec(model, (ReductionType)i, v0, v1, v2); const AcReal modelval = acHostReduceVec(model, (ReductionType)i, v0, v1, v2);
Error error = acGetError(modelval, candval); Error error = acGetError(modelval, candval);
error.maximum_magnitude = acModelReduceVec(model, RTYPE_MAX, v0, v1, v2); error.maximum_magnitude = acHostReduceVec(model, RTYPE_MAX, v0, v1, v2);
error.minimum_magnitude = acModelReduceVec(model, RTYPE_MIN, v0, v1, v1); error.minimum_magnitude = acHostReduceVec(model, RTYPE_MIN, v0, v1, v1);
ERRCHK_ALWAYS(acEvalError(rtype_names[i], error)); ERRCHK_ALWAYS(acEvalError(rtype_names[i], error));
} }
} }
if (pid == 0) { if (pid == 0) {
acMeshDestroy(&model); acHostMeshDestroy(&model);
acMeshDestroy(&candidate); acHostMeshDestroy(&candidate);
} }
acGridQuit(); acGridQuit();

View File

@@ -576,7 +576,7 @@ acmesh_init_to(const InitType& init_type, AcMesh* mesh)
switch (init_type) { switch (init_type) {
case INIT_TYPE_RANDOM: { case INIT_TYPE_RANDOM: {
acMeshClear(mesh); acHostMeshClear(mesh);
const AcReal range = AcReal(0.01); const AcReal range = AcReal(0.01);
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
@@ -585,14 +585,14 @@ acmesh_init_to(const InitType& init_type, AcMesh* mesh)
break; break;
} }
case INIT_TYPE_GAUSSIAN_RADIAL_EXPL: case INIT_TYPE_GAUSSIAN_RADIAL_EXPL:
acMeshClear(mesh); acHostMeshClear(mesh);
acVertexBufferSet(VTXBUF_LNRHO, mesh->info.real_params[AC_ampl_lnrho], mesh); acHostVertexBufferSet(VTXBUF_LNRHO, mesh->info.real_params[AC_ampl_lnrho], mesh);
// acmesh_init_to(INIT_TYPE_RANDOM, mesh); // acmesh_init_to(INIT_TYPE_RANDOM, mesh);
gaussian_radial_explosion(mesh); gaussian_radial_explosion(mesh);
break; break;
case INIT_TYPE_XWAVE: case INIT_TYPE_XWAVE:
acMeshClear(mesh); acHostMeshClear(mesh);
acmesh_init_to(INIT_TYPE_RANDOM, mesh); acmesh_init_to(INIT_TYPE_RANDOM, mesh);
for (int k = 0; k < mz; k++) { for (int k = 0; k < mz; k++) {
for (int j = 0; j < my; j++) { for (int j = 0; j < my; j++) {
@@ -605,24 +605,24 @@ acmesh_init_to(const InitType& init_type, AcMesh* mesh)
} }
break; break;
case INIT_TYPE_SIMPLE_CORE: case INIT_TYPE_SIMPLE_CORE:
acMeshClear(mesh); acHostMeshClear(mesh);
simple_uniform_core(mesh); simple_uniform_core(mesh);
break; break;
case INIT_TYPE_VEDGE: case INIT_TYPE_VEDGE:
acMeshClear(mesh); acHostMeshClear(mesh);
inflow_vedge_freefall(mesh); inflow_vedge_freefall(mesh);
break; break;
case INIT_TYPE_VEDGEX: case INIT_TYPE_VEDGEX:
acMeshClear(mesh); acHostMeshClear(mesh);
inflow_freefall_x(mesh); inflow_freefall_x(mesh);
break; break;
case INIT_TYPE_RAYLEIGH_TAYLOR: case INIT_TYPE_RAYLEIGH_TAYLOR:
acMeshClear(mesh); acHostMeshClear(mesh);
inflow_freefall_x(mesh); inflow_freefall_x(mesh);
lnrho_step(mesh); lnrho_step(mesh);
break; break;
case INIT_TYPE_ABC_FLOW: { case INIT_TYPE_ABC_FLOW: {
acMeshClear(mesh); acHostMeshClear(mesh);
acmesh_init_to(INIT_TYPE_RANDOM, mesh); acmesh_init_to(INIT_TYPE_RANDOM, mesh);
for (int k = nz_min; k < nz_max; k++) { for (int k = nz_min; k < nz_max; k++) {
for (int j = ny_min; j < ny_max; j++) { for (int j = ny_min; j < ny_max; j++) {

View File

@@ -199,9 +199,9 @@ print_diagnostics_host(const AcMesh mesh, const int step, const AcReal dt, const
const int max_name_width = 16; const int max_name_width = 16;
// Calculate rms, min and max from the velocity vector field // Calculate rms, min and max from the velocity vector field
buf_max = acModelReduceVec(mesh, RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ); buf_max = acHostReduceVec(mesh, RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
buf_min = acModelReduceVec(mesh, RTYPE_MIN, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ); buf_min = acHostReduceVec(mesh, RTYPE_MIN, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
buf_rms = acModelReduceVec(mesh, RTYPE_RMS, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ); buf_rms = acHostReduceVec(mesh, RTYPE_RMS, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
// MV: The ordering in the earlier version was wrong in terms of variable // MV: The ordering in the earlier version was wrong in terms of variable
// MV: name and its diagnostics. // MV: name and its diagnostics.
@@ -213,9 +213,9 @@ print_diagnostics_host(const AcMesh mesh, const int step, const AcReal dt, const
// Calculate rms, min and max from the variables as scalars // Calculate rms, min and max from the variables as scalars
for (int i = 0; i < NUM_VTXBUF_HANDLES; ++i) { for (int i = 0; i < NUM_VTXBUF_HANDLES; ++i) {
buf_max = acModelReduceScal(mesh, RTYPE_MAX, VertexBufferHandle(i)); buf_max = acHostReduceScal(mesh, RTYPE_MAX, VertexBufferHandle(i));
buf_min = acModelReduceScal(mesh, RTYPE_MIN, VertexBufferHandle(i)); buf_min = acHostReduceScal(mesh, RTYPE_MIN, VertexBufferHandle(i));
buf_rms = acModelReduceScal(mesh, RTYPE_RMS, VertexBufferHandle(i)); buf_rms = acHostReduceScal(mesh, RTYPE_RMS, VertexBufferHandle(i));
printf(" %*s: min %.3e,\trms %.3e,\tmax %.3e\n", max_name_width, vtxbuf_names[i], printf(" %*s: min %.3e,\trms %.3e,\tmax %.3e\n", max_name_width, vtxbuf_names[i],
double(buf_min), double(buf_rms), double(buf_max)); double(buf_min), double(buf_rms), double(buf_max));
@@ -330,7 +330,7 @@ main(int argc, char** argv)
AcMesh mesh; AcMesh mesh;
if (pid == 0) { if (pid == 0) {
acMeshCreate(info, &mesh); acHostMeshCreate(info, &mesh);
acmesh_init_to(INIT_TYPE_GAUSSIAN_RADIAL_EXPL, &mesh); acmesh_init_to(INIT_TYPE_GAUSSIAN_RADIAL_EXPL, &mesh);
} }
acGridInit(info); acGridInit(info);
@@ -362,7 +362,7 @@ main(int argc, char** argv)
} }
} }
if (pid == 0) if (pid == 0)
acMeshDestroy(&mesh); acHostMeshDestroy(&mesh);
acGridQuit(); acGridQuit();
/////////////// Simple example END /////////////// Simple example END
@@ -376,7 +376,7 @@ main(int argc, char** argv)
if (argc == 3 && (!strcmp(argv[1], "-c") || !strcmp(argv[1], "--config"))) { if (argc == 3 && (!strcmp(argv[1], "-c") || !strcmp(argv[1], "--config"))) {
acLoadConfig(argv[2], &info); acLoadConfig(argv[2], &info);
load_config(argv[2], &info); load_config(argv[2], &info);
acUpdateBuiltinParams(&info); acHostUpdateBuiltinParams(&info);
} }
else { else {
printf("Usage: ./ac_run\n"); printf("Usage: ./ac_run\n");
@@ -388,7 +388,7 @@ main(int argc, char** argv)
else { else {
acLoadConfig(AC_DEFAULT_CONFIG, &info); acLoadConfig(AC_DEFAULT_CONFIG, &info);
load_config(AC_DEFAULT_CONFIG, &info); load_config(AC_DEFAULT_CONFIG, &info);
acUpdateBuiltinParams(&info); acHostUpdateBuiltinParams(&info);
} }
const int start_step = info.int_params[AC_start_step]; const int start_step = info.int_params[AC_start_step];
@@ -406,7 +406,7 @@ main(int argc, char** argv)
AcMesh mesh; AcMesh mesh;
///////////////////////////////// PROC 0 BLOCK START /////////////////////////////////////////// ///////////////////////////////// PROC 0 BLOCK START ///////////////////////////////////////////
if (pid == 0) { if (pid == 0) {
acMeshCreate(info, &mesh); acHostMeshCreate(info, &mesh);
// TODO: This need to be possible to define in astaroth.conf // TODO: This need to be possible to define in astaroth.conf
acmesh_init_to(INIT_TYPE_GAUSSIAN_RADIAL_EXPL, &mesh); acmesh_init_to(INIT_TYPE_GAUSSIAN_RADIAL_EXPL, &mesh);
// acmesh_init_to(INIT_TYPE_SIMPLE_CORE, mesh); //Initial condition for a collapse test // acmesh_init_to(INIT_TYPE_SIMPLE_CORE, mesh); //Initial condition for a collapse test
@@ -564,7 +564,7 @@ main(int argc, char** argv)
acGridQuit(); acGridQuit();
if (pid == 0) if (pid == 0)
acMeshDestroy(&mesh); acHostMeshDestroy(&mesh);
fclose(diag_file); fclose(diag_file);
#endif #endif

View File

@@ -7,9 +7,9 @@
* Utils * Utils
*/ */
void void
acupdatebuiltinparams_(AcMeshInfo* info) achostupdatebuiltinparams_(AcMeshInfo* info)
{ {
acUpdateBuiltinParams(info); acHostUpdateBuiltinParams(info);
} }
void void

View File

@@ -8,7 +8,7 @@ extern "C" {
/** /**
* Utils * Utils
*/ */
void acupdatebuiltinparams_(AcMeshInfo* info); void achostupdatebuiltinparams_(AcMeshInfo* info);
void acgetdevicecount_(int* count); void acgetdevicecount_(int* count);

View File

@@ -89,7 +89,7 @@ acLoadConfig(const char* config_path, AcMeshInfo* config)
memset(config, (uint8_t)0xFF, sizeof(*config)); memset(config, (uint8_t)0xFF, sizeof(*config));
parse_config(config_path, config); parse_config(config_path, config);
acUpdateBuiltinParams(config); acHostUpdateBuiltinParams(config);
#if AC_VERBOSE #if AC_VERBOSE
printf("###############################################################\n"); printf("###############################################################\n");
printf("Config dimensions loaded:\n"); printf("Config dimensions loaded:\n");

View File

@@ -21,7 +21,7 @@
#include "errchk.h" #include "errchk.h"
AcResult AcResult
acVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* mesh) acHostVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* mesh)
{ {
const int n = acVertexBufferSize(mesh->info); const int n = acVertexBufferSize(mesh->info);
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
@@ -30,16 +30,16 @@ acVertexBufferSet(const VertexBufferHandle handle, const AcReal value, AcMesh* m
return AC_SUCCESS; return AC_SUCCESS;
} }
AcResult AcResult
acMeshSet(const AcReal value, AcMesh* mesh) acHostMeshSet(const AcReal value, AcMesh* mesh)
{ {
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w)
acVertexBufferSet(w, value, mesh); acHostVertexBufferSet(w, value, mesh);
return AC_SUCCESS; return AC_SUCCESS;
} }
AcResult AcResult
acMeshApplyPeriodicBounds(AcMesh* mesh) acHostMeshApplyPeriodicBounds(AcMesh* mesh)
{ {
const AcMeshInfo info = mesh->info; const AcMeshInfo info = mesh->info;
for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) { for (int w = 0; w < NUM_VTXBUF_HANDLES; ++w) {
@@ -105,7 +105,7 @@ acMeshApplyPeriodicBounds(AcMesh* mesh)
} }
AcResult AcResult
acMeshClear(AcMesh* mesh) acHostMeshClear(AcMesh* mesh)
{ {
return acMeshSet(0, mesh); return acHostMeshSet(0, mesh);
} }

View File

@@ -74,7 +74,7 @@ exp_squared_vec(const AcReal a, const AcReal b, const AcReal c) { return exp_squ
// clang-format on // clang-format on
AcReal AcReal
acModelReduceScal(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a) acHostReduceScal(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a)
{ {
ReduceInitialScalFunc reduce_initial; ReduceInitialScalFunc reduce_initial;
ReduceFunc reduce; ReduceFunc reduce;
@@ -139,7 +139,7 @@ acModelReduceScal(const AcMesh mesh, const ReductionType rtype, const VertexBuff
} }
AcReal AcReal
acModelReduceVec(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a, acHostReduceVec(const AcMesh mesh, const ReductionType rtype, const VertexBufferHandle a,
const VertexBufferHandle b, const VertexBufferHandle c) const VertexBufferHandle b, const VertexBufferHandle c)
{ {
// AcReal (*reduce_initial)(AcReal, AcReal, AcReal); // AcReal (*reduce_initial)(AcReal, AcReal, AcReal);

View File

@@ -30,7 +30,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "errchk.h" #include "errchk.h"
#include "memory.h" // acMeshCreate, acMeshDestroy, acMeshApplyPeriodicBounds #include "memory.h" // acHostMeshCreate, acHostMeshDestroy, acMeshApplyPeriodicBounds
// Standalone flags // Standalone flags
#define LDENSITY (1) #define LDENSITY (1)
@@ -985,7 +985,7 @@ checkConfiguration(const AcMeshInfo info)
} }
AcResult AcResult
acModelIntegrateStep(AcMesh mesh, const AcReal dt) acHostIntegrateStep(AcMesh mesh, const AcReal dt)
{ {
mesh_info = &(mesh.info); mesh_info = &(mesh.info);
@@ -998,7 +998,7 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
checkConfiguration(*mesh_info); checkConfiguration(*mesh_info);
AcMesh intermediate_mesh; AcMesh intermediate_mesh;
acMeshCreate(mesh.info, &intermediate_mesh); acHostMeshCreate(mesh.info, &intermediate_mesh);
const int nx_min = getInt(AC_nx_min); const int nx_min = getInt(AC_nx_min);
const int nx_max = getInt(AC_nx_max); const int nx_max = getInt(AC_nx_max);
@@ -1012,7 +1012,7 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
for (int step_number = 0; step_number < 3; ++step_number) { for (int step_number = 0; step_number < 3; ++step_number) {
// Boundconds // Boundconds
acMeshApplyPeriodicBounds(&mesh); acHostMeshApplyPeriodicBounds(&mesh);
// Alpha step // Alpha step
// #pragma omp parallel for // #pragma omp parallel for
@@ -1035,7 +1035,7 @@ acModelIntegrateStep(AcMesh mesh, const AcReal dt)
} }
} }
acMeshDestroy(&intermediate_mesh); acHostMeshDestroy(&intermediate_mesh);
mesh_info = NULL; mesh_info = NULL;
return AC_SUCCESS; return AC_SUCCESS;
} }