Merge branch 'update_examples_to_use_proper_backends' into 'master'
Update examples to use proper backends See merge request !195
This commit is contained in:
commit
1b9486149d
@ -31,7 +31,7 @@ if(OPENGL_FOUND AND GLUT_FOUND)
|
||||
target_link_libraries(HelloWorld_SERIAL ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES})
|
||||
|
||||
if(VTKm_Cuda_FOUND)
|
||||
cuda_add_executable(HelloWorld_CUDA HelloWorld.cxx)
|
||||
cuda_add_executable(HelloWorld_CUDA HelloWorld.cu)
|
||||
target_link_libraries(HelloWorld_CUDA ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
24
examples/hello_world/HelloWorld.cu
Normal file
24
examples/hello_world/HelloWorld.cu
Normal file
@ -0,0 +1,24 @@
|
||||
//============================================================================
|
||||
// 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 BOOST_SP_DISABLE_THREADS
|
||||
|
||||
#include "HelloWorld.cxx"
|
@ -17,6 +17,13 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
//We first check if VTKM_DEVICE_ADAPTER is defined, so that when TBB and CUDA
|
||||
//includes this file we use the device adapter that they have set.
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
@ -182,6 +189,11 @@ void idle()
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
typedef vtkm::cont::internal::DeviceAdapterTraits<DeviceAdapter>
|
||||
DeviceAdapterTraits;
|
||||
std::cout << "Running Hello World example on device adapter: "
|
||||
<< DeviceAdapterTraits::GetId() << std::endl;
|
||||
|
||||
glewExperimental = GL_TRUE;
|
||||
glutInit(&argc, argv);
|
||||
|
||||
|
23
examples/hello_world/HelloWorldTBB.cxx
Normal file
23
examples/hello_world/HelloWorldTBB.cxx
Normal file
@ -0,0 +1,23 @@
|
||||
//============================================================================
|
||||
// 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
|
||||
|
||||
#include "HelloWorld.cxx"
|
@ -29,14 +29,14 @@ if(OPENGL_FOUND AND GLUT_FOUND)
|
||||
add_executable(IsosurfaceUniformGrid_SERIAL IsosurfaceUniformGrid.cxx)
|
||||
target_include_directories(IsosurfaceUniformGrid_SERIAL PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(IsosurfaceUniformGrid_SERIAL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
|
||||
|
||||
|
||||
if(VTKm_Cuda_FOUND)
|
||||
cuda_add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cxx)
|
||||
cuda_add_executable(IsosurfaceUniformGrid_CUDA IsosurfaceUniformGrid.cu)
|
||||
target_link_libraries(IsosurfaceUniformGrid_CUDA ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(VTKm_ENABLE_TBB)
|
||||
add_executable(IsosurfaceUniformGrid_TBB IsosurfaceUniformGrid.cxx)
|
||||
add_executable(IsosurfaceUniformGrid_TBB IsosurfaceUniformGridTBB.cxx)
|
||||
target_include_directories(IsosurfaceUniformGrid_TBB PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${TBB_INCLUDE_DIRS})
|
||||
target_link_libraries(IsosurfaceUniformGrid_TBB ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${TBB_LIBRARIES})
|
||||
endif()
|
||||
|
24
examples/isosurface/IsosurfaceUniformGrid.cu
Normal file
24
examples/isosurface/IsosurfaceUniformGrid.cu
Normal file
@ -0,0 +1,24 @@
|
||||
//============================================================================
|
||||
// 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 BOOST_SP_DISABLE_THREADS
|
||||
|
||||
#include "IsosurfaceUniformGrid.cxx"
|
@ -18,6 +18,12 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
//We first check if VTKM_DEVICE_ADAPTER is defined, so that when TBB and CUDA
|
||||
//includes this file we use the device adapter that they have set.
|
||||
#ifndef VTKM_DEVICE_ADAPTER
|
||||
#define VTKM_DEVICE_ADAPTER VTKM_DEVICE_ADAPTER_SERIAL
|
||||
#endif
|
||||
|
||||
#include <vtkm/worklet/IsosurfaceUniformGrid.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
@ -162,7 +168,7 @@ void displayCall()
|
||||
qrot.getRotMat(rotationMatrix);
|
||||
glMultMatrixf(rotationMatrix);
|
||||
glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
|
||||
glColor3f(0.1f, 0.1f, 0.6f);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
@ -214,7 +220,10 @@ void mouseCall(int button, int state, int x, int y)
|
||||
// Compute and render an isosurface for a uniform grid example
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::cout << "IsosurfaceUniformGrid Example" << std::endl;
|
||||
typedef vtkm::cont::internal::DeviceAdapterTraits<DeviceAdapter>
|
||||
DeviceAdapterTraits;
|
||||
std::cout << "Running IsosurfaceUniformGrid example on device adapter: "
|
||||
<< DeviceAdapterTraits::GetId() << std::endl;
|
||||
|
||||
vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims);
|
||||
|
||||
@ -227,7 +236,7 @@ int main(int argc, char* argv[])
|
||||
scalarsArray);
|
||||
|
||||
std::cout << "Number of output vertices: " << verticesArray.GetNumberOfValues() << std::endl;
|
||||
|
||||
|
||||
lastx = lasty = 0;
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
|
23
examples/isosurface/IsosurfaceUniformGridTBB.cxx
Normal file
23
examples/isosurface/IsosurfaceUniformGridTBB.cxx
Normal file
@ -0,0 +1,23 @@
|
||||
//============================================================================
|
||||
// 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
|
||||
|
||||
#include "IsosurfaceUniformGrid.cxx"
|
Loading…
Reference in New Issue
Block a user