Added acGridLoadScalarUniform and acGridLoadVectorUniform functions for loading specific device constants with MPI
This commit is contained in:
@@ -282,6 +282,13 @@ AcResult acGridQuit(void);
|
|||||||
/** */
|
/** */
|
||||||
AcResult acGridSynchronizeStream(const Stream stream);
|
AcResult acGridSynchronizeStream(const Stream stream);
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult acGridLoadScalarUniform(const Stream stream, const AcRealParam param, const AcReal value);
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult acGridLoadVectorUniform(const Stream stream, const AcReal3Param param,
|
||||||
|
const AcReal3 value);
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
AcResult acGridLoadMesh(const Stream stream, const AcMesh host_mesh);
|
AcResult acGridLoadMesh(const Stream stream, const AcMesh host_mesh);
|
||||||
|
|
||||||
|
@@ -1325,6 +1325,47 @@ acGridQuit(void)
|
|||||||
return AC_SUCCESS;
|
return AC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AcResult
|
||||||
|
acGridLoadScalarUniform(const Stream stream, const AcRealParam param, const AcReal value)
|
||||||
|
{
|
||||||
|
ERRCHK(grid.initialized);
|
||||||
|
acGridSynchronizeStream(stream);
|
||||||
|
|
||||||
|
#if AC_DOUBLE_PRECISION == 1
|
||||||
|
MPI_Datatype datatype = MPI_DOUBLE;
|
||||||
|
#else
|
||||||
|
MPI_Datatype datatype = MPI_FLOAT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const int root_proc = 0;
|
||||||
|
AcReal buffer = value;
|
||||||
|
MPI_Bcast(&buffer, 1, datatype, root_proc, MPI_COMM_WORLD);
|
||||||
|
|
||||||
|
acDeviceLoadScalarUniform(grid.device, stream, param, buffer);
|
||||||
|
return AC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
AcResult
|
||||||
|
acGridLoadVectorUniform(const Stream stream, const AcReal3Param param, const AcReal3 value)
|
||||||
|
{
|
||||||
|
ERRCHK(grid.initialized);
|
||||||
|
acGridSynchronizeStream(stream);
|
||||||
|
|
||||||
|
#if AC_DOUBLE_PRECISION == 1
|
||||||
|
MPI_Datatype datatype = MPI_DOUBLE;
|
||||||
|
#else
|
||||||
|
MPI_Datatype datatype = MPI_FLOAT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const int root_proc = 0;
|
||||||
|
AcReal3 buffer = value;
|
||||||
|
MPI_Bcast(&buffer, 3, datatype, root_proc, MPI_COMM_WORLD);
|
||||||
|
|
||||||
|
acDeviceLoadVectorUniform(grid.device, stream, param, buffer);
|
||||||
|
return AC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
AcResult
|
AcResult
|
||||||
acGridLoadMesh(const Stream stream, const AcMesh host_mesh)
|
acGridLoadMesh(const Stream stream, const AcMesh host_mesh)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user