removing most of the compile warnings, and adding CUDA and TBB tests for rectilinear grids

This commit is contained in:
ayenpure 2017-07-03 15:39:48 -04:00
parent 14af69a8b5
commit b2765881df
9 changed files with 109 additions and 44 deletions

@ -30,7 +30,7 @@ target_include_directories(Particle_Advection_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS
target_link_libraries(Particle_Advection_SERIAL ${VTKm_LIBRARIES})
target_compile_options(Particle_Advection_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(Particle_Advection_RL_SERIAL ParticleAdvectionRL.cxx)
add_executable(Particle_Advection_RL_SERIAL ParticleAdvectionRectilinear.cxx)
target_include_directories(Particle_Advection_RL_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Particle_Advection_RL_SERIAL ${VTKm_LIBRARIES})
target_compile_options(Particle_Advection_RL_SERIAL PRIVATE ${VTKm_COMPILE_OPTIONS})
@ -40,6 +40,11 @@ if(VTKm_TBB_FOUND)
target_include_directories(Particle_Advection_TBB PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Particle_Advection_TBB ${VTKm_LIBRARIES})
target_compile_options(Particle_Advection_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
add_executable(Particle_Advection_RL_TBB ParticleAdvectionRectilinearTBB.cxx)
target_include_directories(Particle_Advection_RL_TBB PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Particle_Advection_RL_TBB ${VTKm_LIBRARIES})
target_compile_options(Particle_Advection_RL_TBB PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()
if(VTKm_CUDA_FOUND)
@ -49,4 +54,10 @@ if(VTKm_CUDA_FOUND)
target_include_directories(Particle_Advection_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Particle_Advection_CUDA PRIVATE ${VTKm_LIBRARIES})
target_compile_options(Particle_Advection_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
cuda_include_directories(${VTKm_INCLUDE_DIRS})
cuda_add_executable(Particle_Advection_RL_CUDA ParticleAdvectionRectilinear.cu)
target_include_directories(Particle_Advection_RL_SERIAL PRIVATE ${VTKm_INCLUDE_DIRS})
target_link_libraries(Particle_Advection_RL_CUDA PRIVATE ${VTKm_LIBRARIES})
target_compile_options(Particle_Advection_RL_CUDA PRIVATE ${VTKm_COMPILE_OPTIONS})
endif()

@ -38,12 +38,16 @@ const vtkm::Id SPARSE=0;
const vtkm::Id DENSE=1;
const vtkm::Id MEDIUM=2;
template <typename T>
static vtkm::Range
subRange(vtkm::Range &range, vtkm::Float32 a, vtkm::Float32 b)
subRange(vtkm::Range &range, T a, T b)
{
vtkm::Float32 len = range.Length();
return vtkm::Range(range.Min + a*len,
range.Min + b*len);
vtkm::Float32 arg1, arg2, len;
arg1 = static_cast<vtkm::Float32>(a);
arg2 = static_cast<vtkm::Float32>(b);
len = static_cast<vtkm::Float32>(range.Length());
return vtkm::Range(range.Min + arg1*len,
range.Min + arg2*len);
}
void RunTest(const std::string &fname,

@ -0,0 +1,25 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_CUDA
#define __BUILDING_CUDA_VERSION__
#include "ParticleAdvectionRectilinear.cxx"

@ -39,12 +39,16 @@ const vtkm::Id SPARSE=0;
const vtkm::Id DENSE=1;
const vtkm::Id MEDIUM=2;
template <typename NumType>
static vtkm::Range
subRange(vtkm::Range &range, vtkm::Float32 a, vtkm::Float32 b)
subRange(vtkm::Range &range, NumType a, NumType b)
{
vtkm::Float32 len = static_cast<vtkm::Float32>(range.Length());
return vtkm::Range(range.Min + a*len,
range.Min + b*len);
vtkm::Float32 arg1, arg2, len;
arg1 = static_cast<vtkm::Float32>(a);
arg2 = static_cast<vtkm::Float32>(b);
len = static_cast<vtkm::Float32>(range.Length());
return vtkm::Range(range.Min + arg1*len,
range.Min + arg2*len);
}
void RunTest(const std::string &fname,

@ -0,0 +1,26 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2014 Sandia Corporation.
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_TBB
#define __BUILDING_TBB_VERSION__
#include <tbb/task_scheduler_init.h>
#include "ParticleAdvectionRectilinear.cxx"

@ -243,7 +243,7 @@ private:
throw vtkm::io::ErrorIO("Unable to open data file: "+fName);
buff.resize(sz);
std::size_t nread = fread(&buff[0], sizeof(T), sz, fp);
if (nread != sz)
if (nread != static_cast<std::size_t>(sz))
throw vtkm::io::ErrorIO("Data file read failed: "+fName);
fclose(fp);
}
@ -280,8 +280,8 @@ private:
}
}
bool Loaded;
std::string FileName;
bool Loaded;
vtkm::cont::DataSet DataSet;
};

@ -374,7 +374,6 @@ private:
};//RectilinearGridEvaluate
} //namespace particleadvection
} //namespace worklet
} //namespace vtkm

@ -123,8 +123,8 @@ public:
typedef vtkm::worklet::particleadvection::Particles<FieldType, DeviceAdapterTag> ParticleType;
vtkm::Id totNumSeeds = seeds.size();
vtkm::Id numSeeds = totNumSeeds;
bool NeedParticleRounds = false;
vtkm::Id numSeeds = totNumSeeds;
if (ParticlesPerRound == -1 || ParticlesPerRound > totNumSeeds)
numSeeds = totNumSeeds;
@ -201,9 +201,8 @@ public:
typedef vtkm::worklet::particleadvection::StateRecordingParticlesRound<FieldType, DeviceAdapterTag> StreamlineRoundType;
vtkm::Id totNumSeeds = seeds.size();
vtkm::Id numSeeds = totNumSeeds;
bool NeedParticleRounds = false;
vtkm::Id numSeeds = totNumSeeds;
if (ParticlesPerRound == -1 || ParticlesPerRound > totNumSeeds)
numSeeds = totNumSeeds;

@ -46,13 +46,13 @@ private:
::template ExecutionTypes<DeviceAdapterTag>::Portal PosPortal;
public:
VTKM_EXEC_CONT
Particles() : pos(), steps(), maxSteps(0), status()
Particles() : pos(), steps(), status(), maxSteps(0)
{
}
VTKM_EXEC_CONT
Particles(const Particles &ic) :
pos(ic.pos), steps(ic.steps), maxSteps(ic.maxSteps), status(ic.status)
pos(ic.pos), steps(ic.steps), status(ic.status), maxSteps(ic.maxSteps)
{
}
@ -60,7 +60,7 @@ public:
Particles(const PosPortal &_pos,
const IdPortal &_steps,
const IdPortal &_status,
const vtkm::Id &_maxSteps) : pos(_pos), steps(_steps), maxSteps(_maxSteps), status(_status)
const vtkm::Id &_maxSteps) : pos(_pos), steps(_steps), status(_status), maxSteps(_maxSteps)
{
}
@ -113,9 +113,9 @@ public:
vtkm::Id GetStatus(const vtkm::Id &idx) const {return status.Get(idx);}
private:
PosPortal pos;
PosPortal pos;
IdPortal steps, status;
vtkm::Id maxSteps;
IdPortal steps, status;
};
template<typename T,typename DeviceAdapterTag>
@ -129,24 +129,23 @@ private:
public:
VTKM_EXEC_CONT
StateRecordingParticles(const StateRecordingParticles &s) :
pos(s.pos), steps(s.steps), maxSteps(s.maxSteps),
history(s.history), histSize(s.histSize),
status(s.status)
pos(s.pos), steps(s.steps), status(s.status),
maxSteps(s.maxSteps), histSize(s.histSize), history(s.history)
{
}
VTKM_EXEC_CONT
StateRecordingParticles() : pos(), steps(), maxSteps(0), histSize(-1)
StateRecordingParticles() : pos(), steps(), status(), maxSteps(0), histSize(-1), history()
{
}
VTKM_EXEC_CONT
StateRecordingParticles(const PosPortal &_pos,
const IdPortal &_steps,
const IdPortal &_status,
const IdPortal &_status,
const vtkm::Id &_maxSteps) :
pos(_pos), steps(_steps), maxSteps(_maxSteps), status(_status)
pos(_pos), steps(_steps), status(_status), maxSteps(_maxSteps), histSize(), history()
{
//std::cout<<"why calling this?????"<<std::endl;
}
VTKM_EXEC_CONT
@ -158,8 +157,7 @@ public:
{
pos = posArray.PrepareForInPlace(DeviceAdapterTag());
steps = stepsArray.PrepareForInPlace(DeviceAdapterTag());
status = statusArray.PrepareForInPlace(DeviceAdapterTag());
status = statusArray.PrepareForInPlace(DeviceAdapterTag());
numPos = posArray.GetNumberOfValues();
history = historyArray.PrepareForOutput(numPos*histSize, DeviceAdapterTag());
}
@ -175,7 +173,6 @@ public:
pos = posArray.PrepareForInPlace(DeviceAdapterTag());
steps = stepsArray.PrepareForInPlace(DeviceAdapterTag());
status = statusArray.PrepareForInPlace(DeviceAdapterTag());
numPos = posArray.GetNumberOfValues();
history = historyArray.PrepareForOutput(numPos*histSize, DeviceAdapterTag());
}
@ -224,9 +221,10 @@ public:
}
private:
vtkm::Id maxSteps, numPos, histSize;
PosPortal pos;
IdPortal steps, status;
PosPortal pos, history;
vtkm::Id maxSteps, numPos, histSize;
PosPortal history;
public:
vtkm::cont::ArrayHandle<vtkm::Vec<T,3> > historyArray;
};
@ -244,12 +242,12 @@ private:
public:
VTKM_EXEC_CONT
StateRecordingParticlesRound(const StateRecordingParticlesRound &s) :
pos(s.pos), steps(s.steps), maxSteps(s.maxSteps),
history(s.history), histSize(s.histSize),
status(s.status), offset(s.offset), numPos(s.numPos),
totalMaxSteps(s.totalMaxSteps)
pos(s.pos), steps(s.steps), status(s.status),
maxSteps(s.maxSteps), numPos(s.numPos), histSize(s.histSize),
offset(s.offset), totalMaxSteps(s.totalMaxSteps), history(s.history)
{
}
VTKM_EXEC_CONT
StateRecordingParticlesRound() : pos(), steps(), maxSteps(0), histSize(-1), offset(0), totalMaxSteps(0)
{
@ -258,14 +256,13 @@ public:
VTKM_EXEC_CONT
StateRecordingParticlesRound(const PosPortal &_pos,
const IdPortal &_steps,
const IdPortal &_status,
const IdPortal &_status,
const vtkm::Id &_maxSteps,
const vtkm::Id &_histSize,
const vtkm::Id &_offset,
const vtkm::Id &_totalMaxSteps) :
pos(_pos), steps(_steps), maxSteps(_maxSteps), status(_status), histSize(_histSize), offset(_offset), totalMaxSteps(_totalMaxSteps)
pos(_pos), steps(_steps), status(_status), maxSteps(_maxSteps), histSize(_histSize), offset(_offset), totalMaxSteps(_totalMaxSteps)
{
//std::cout<<"why calling this?????"<<std::endl;
}
VTKM_EXEC_CONT
@ -276,12 +273,11 @@ public:
const vtkm::Id &_histSize,
const vtkm::Id &_offset,
const vtkm::Id &_totalMaxSteps) :
maxSteps(_maxSteps), histSize(_histSize), offset(_offset),totalMaxSteps(_totalMaxSteps)
maxSteps(_maxSteps), histSize(_histSize), offset(_offset), totalMaxSteps(_totalMaxSteps)
{
pos = posArray.PrepareForInPlace(DeviceAdapterTag());
steps = stepsArray.PrepareForInPlace(DeviceAdapterTag());
status = statusArray.PrepareForInPlace(DeviceAdapterTag());
numPos = posArray.GetNumberOfValues();
history = historyArray.PrepareForOutput(numPos*histSize, DeviceAdapterTag());
}
@ -331,10 +327,11 @@ public:
return history.Get(idx*histSize+step);
}
public:
vtkm::Id maxSteps, numPos, histSize, offset, totalMaxSteps;
private:
PosPortal pos;
IdPortal steps, status;
PosPortal pos, history;
vtkm::Id maxSteps, numPos, histSize, offset, totalMaxSteps;
PosPortal history;
public:
vtkm::cont::ArrayHandle<vtkm::Vec<T,3> > historyArray;
};