Added more warnings since its easy to make off-by-one mistakes when dealing with fortran-c-interop

This commit is contained in:
jpekkila
2020-06-28 18:14:54 +03:00
parent e764725564
commit 50fb54f1aa
2 changed files with 12 additions and 2 deletions

View File

@@ -42,7 +42,8 @@ void
acdeviceloadmesh_(const Device* device, const Stream* stream, const AcMeshInfo* info,
const int* num_farrays, AcReal* farray)
{
ERRCHK_ALWAYS(*num_farrays == NUM_VTXBUF_HANDLES);
ERRCHK_ALWAYS(*num_farrays >= NUM_VTXBUF_HANDLES);
WARNCHK_ALWAYS(*num_farrays == NUM_VTXBUF_HANDLES);
const size_t mxyz = info->int_params[AC_mx] * info->int_params[AC_mx] * info->int_params[AC_mx];
AcMesh mesh;
@@ -57,7 +58,8 @@ void
acdevicestoremesh_(const Device* device, const Stream* stream, const AcMeshInfo* info,
const int* num_farrays, AcReal* farray)
{
ERRCHK_ALWAYS(*num_farrays == NUM_VTXBUF_HANDLES);
ERRCHK_ALWAYS(*num_farrays >= NUM_VTXBUF_HANDLES);
WARNCHK_ALWAYS(*num_farrays == NUM_VTXBUF_HANDLES);
AcMesh mesh;
mesh.info = *info;
@@ -109,3 +111,9 @@ acdeviceloadmeshinfo_(const Device* device, const AcMeshInfo* info)
{
acDeviceLoadMeshInfo(*device, *info);
}
void
acgetdevicecount_(int* count)
{
ERRCHK_CUDA_ALWAYS(cudaGetDeviceCount(count));
}

View File

@@ -215,6 +215,8 @@ AcResult
acKernelIntegrateSubstep(const cudaStream_t stream, const int step_number, const int3 start,
const int3 end, VertexBufferArray vba)
{
ERRCHK_ALWAYS(step_number >= 0);
ERRCHK_ALWAYS(step_number < 3);
const dim3 tpb = rk3_tpb;
const int3 n = end - start;