Update HelloWorld Example to properly use the correct device adapter.

This commit is contained in:
Robert Maynard 2015-09-15 14:15:56 -04:00
parent 4b70770d48
commit 5ce3e1f3d0
3 changed files with 37 additions and 1 deletions

@ -29,9 +29,12 @@ if(OPENGL_FOUND AND GLUT_FOUND)
add_executable(HelloWorld_SERIAL HelloWorld.cxx)
target_include_directories(HelloWorld_SERIAL PRIVATE ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
target_link_libraries(HelloWorld_SERIAL ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES})
set_property(TARGET HelloWorld_SERIAL
APPEND
PROPERTY COMPILE_DEFINITIONS "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_SERIAL")
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()
@ -39,6 +42,10 @@ if(OPENGL_FOUND AND GLUT_FOUND)
add_executable(HelloWorld_TBB HelloWorld.cxx)
target_include_directories(HelloWorld_TBB PRIVATE ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
target_link_libraries(HelloWorld_TBB ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLUT_LIBRARIES} ${TBB_LIBRARIES})
set_property(TARGET HelloWorld_TBB
APPEND
PROPERTY COMPILE_DEFINITIONS "VTKM_DEVICE_ADAPTER=VTKM_DEVICE_ADAPTER_TBB")
endif()
endif()

@ -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"

@ -182,6 +182,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);