Merge branch 'master' of gitlab.kitware.com:vtk/vtk-m
This commit is contained in:
commit
a41e0f28df
@ -64,8 +64,8 @@ set(VTKm_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
|
||||
set(VTKm_ENABLE_CUDA "@VTKm_ENABLE_CUDA@")
|
||||
set(VTKm_ENABLE_TBB "@VTKm_ENABLE_TBB@")
|
||||
set(VTKm_ENABLE_OPENGL_INTEROP "@VTKm_ENABLE_OPENGL_INTEROP@")
|
||||
set(VTKm_BUILD_RENDERING "@VTKm_BUILD_RENDERING@")
|
||||
set(VTKm_ENABLE_OSMESA "@VTKm_ENABLE_OSMESA@")
|
||||
set(VTKm_ENABLE_RENDERING "@VTKm_ENABLE_RENDERING@")
|
||||
|
||||
# Load the library exports, but only if not compiling VTK-m itself
|
||||
set_and_check(VTKm_CONFIG_DIR "@PACKAGE_VTKm_INSTALL_CONFIG_DIR@")
|
||||
|
@ -209,14 +209,14 @@ macro(vtkm_configure_component_Interop)
|
||||
endmacro(vtkm_configure_component_Interop)
|
||||
|
||||
macro(vtkm_configure_component_Rendering)
|
||||
if(VTKm_BUILD_RENDERING)
|
||||
if(VTKm_ENABLE_RENDERING)
|
||||
vtkm_configure_component_OpenGL()
|
||||
vtkm_configure_component_EGL()
|
||||
vtkm_configure_component_OSMesa()
|
||||
endif()
|
||||
|
||||
vtkm_finish_configure_component(Rendering
|
||||
DEPENDENT_VARIABLES VTKm_BUILD_RENDERING VTKm_Base_FOUND
|
||||
DEPENDENT_VARIABLES VTKm_ENABLE_RENDERING VTKm_Base_FOUND
|
||||
ADD_LIBRARIES vtkm_rendering
|
||||
)
|
||||
endmacro(vtkm_configure_component_Rendering)
|
||||
@ -267,7 +267,9 @@ macro(vtkm_configure_component_CUDA)
|
||||
# Setup build flags for CUDA to have C++11 support
|
||||
#---------------------------------------------------------------------------
|
||||
if(NOT MSVC)
|
||||
list(APPEND CUDA_NVCC_FLAGS --std c++11)
|
||||
if(NOT "--std" IN_LIST CUDA_NVCC_FLAGS)
|
||||
list(APPEND CUDA_NVCC_FLAGS --std c++11)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@ -293,7 +295,10 @@ macro(vtkm_configure_component_CUDA)
|
||||
# 4 - maxwell
|
||||
# - Uses: --generate-code arch=compute_50,code=compute_50
|
||||
# - Uses: --generate-code arch=compute_52,code=compute_52
|
||||
# 5 - all
|
||||
# 5 - pascal
|
||||
# - Uses: --generate-code arch=compute_60,code=compute_60
|
||||
# - Uses: --generate-code arch=compute_61,code=compute_61
|
||||
# 6 - all
|
||||
# - Uses: --generate-code arch=compute_20,code=compute_20
|
||||
# - Uses: --generate-code arch=compute_30,code=compute_30
|
||||
# - Uses: --generate-code arch=compute_35,code=compute_35
|
||||
@ -309,14 +314,14 @@ macro(vtkm_configure_component_CUDA)
|
||||
|
||||
if(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT)
|
||||
#Use the cached value
|
||||
list(APPEND CUDA_NVCC_FLAG S{VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT})
|
||||
list(APPEND CUDA_NVCC_FLAGS ${VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT})
|
||||
else()
|
||||
|
||||
#run execute_process to do auto_detection
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(args "-ccbin" "${CMAKE_CXX_COMPILER}" "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cxx")
|
||||
set(args "-ccbin" "${CMAKE_CXX_COMPILER}" "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cu")
|
||||
else()
|
||||
set(args "-ccbin" "${CUDA_HOST_COMPILER}" "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cxx")
|
||||
set(args "-ccbin" "${CUDA_HOST_COMPILER}" "--run" "${VTKm_CMAKE_MODULE_PATH}/VTKmDetectCUDAVersion.cu")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
@ -328,10 +333,11 @@ macro(vtkm_configure_component_CUDA)
|
||||
#find the position of the "--generate-code" output. With some compilers such as
|
||||
#msvc we get compile output plus run output. So we need to strip out just the
|
||||
#run output
|
||||
message(STATUS "run_output: ${run_output}")
|
||||
string(FIND "${run_output}" "--generate-code" position)
|
||||
string(SUBSTRING "${run_output}" ${position} -1 run_output)
|
||||
|
||||
list(APPEND CUDA_NVCC_FLAG S{run_output})
|
||||
list(APPEND CUDA_NVCC_FLAGS ${run_output})
|
||||
set(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN_OUTPUT ${run_output} CACHE INTERNAL
|
||||
"device type(s) for cuda[native]")
|
||||
else()
|
||||
@ -353,12 +359,17 @@ Falling back to fermi, please manually specify if you want something else.")
|
||||
elseif(VTKm_CUDA_Architecture STREQUAL "maxwell")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_50,code=compute_50")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_52,code=compute_52")
|
||||
elseif(VTKm_CUDA_Architecture STREQUAL "pascal")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_60,code=compute_60")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_61,code=compute_61")
|
||||
elseif(VTKm_CUDA_Architecture STREQUAL "all")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_20,code=compute_20")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_30,code=compute_30")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_35,code=compute_35")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_50,code=compute_50")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_52,code=compute_52")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_60,code=compute_60")
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --generate-code arch=compute_61,code=compute_61")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
49
CMake/VTKmDetectCUDAVersion.cu
Normal file
49
CMake/VTKmDetectCUDAVersion.cu
Normal file
@ -0,0 +1,49 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// 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 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 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.
|
||||
//
|
||||
//=============================================================================
|
||||
#include <cuda.h>
|
||||
#include <cuda_runtime.h>
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
int count = 0;
|
||||
if (cudaSuccess != cudaGetDeviceCount(&count)) return 1;
|
||||
if (count == 0) return 1;
|
||||
|
||||
int prev_arch = 0;
|
||||
for (int device = 0; device < count; ++device)
|
||||
{
|
||||
cudaDeviceProp prop;
|
||||
if (cudaSuccess == cudaGetDeviceProperties(&prop, device))
|
||||
{
|
||||
int arch = (prop.major * 10) + prop.minor;
|
||||
int compute_level = arch;
|
||||
//arch 21 has no equivalent compute level.
|
||||
if(compute_level == 21) { compute_level = 20; }
|
||||
|
||||
//handle multiple cards of the same architecture
|
||||
if(arch == prev_arch) { continue; }
|
||||
prev_arch = arch;
|
||||
printf("--generate-code arch=compute_%d,code=sm_%d ", compute_level, arch);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// 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 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 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.
|
||||
//
|
||||
//=============================================================================
|
||||
#include <cuda.h>
|
||||
#include <cuda_runtime.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::map< int, std::string > arch_to_compute;
|
||||
arch_to_compute[11] = "compute_11";
|
||||
arch_to_compute[12] = "compute_12";
|
||||
arch_to_compute[13] = "compute_13";
|
||||
arch_to_compute[20] = "compute_20";
|
||||
arch_to_compute[21] = "compute_20";
|
||||
arch_to_compute[30] = "compute_30";
|
||||
arch_to_compute[32] = "compute_32";
|
||||
arch_to_compute[35] = "compute_35";
|
||||
arch_to_compute[37] = "compute_37";
|
||||
arch_to_compute[50] = "compute_50";
|
||||
arch_to_compute[52] = "compute_52";
|
||||
arch_to_compute[53] = "compute_53";
|
||||
|
||||
cudaError_t err;
|
||||
int nDevices;
|
||||
err = cudaGetDeviceCount(&nDevices);
|
||||
if(err != cudaSuccess || nDevices < 1)
|
||||
{ //return failure if no cuda devices found
|
||||
return 1;
|
||||
}
|
||||
|
||||
//iterate over the devices outputting a string that would be the compile
|
||||
//flags needed to target all gpu's on this machine.
|
||||
int prev_arch = 0;
|
||||
for (int i = 0; i < nDevices; i++)
|
||||
{
|
||||
cudaDeviceProp prop;
|
||||
err = cudaGetDeviceProperties(&prop, i);
|
||||
if(err != cudaSuccess)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//convert 2.1 to 21, 3.5 to 35, etc
|
||||
int arch = (prop.major * 10) + prop.minor;
|
||||
|
||||
//if we have multiple gpu's make sure they have different arch's
|
||||
//instead of adding the same compile options multiple times
|
||||
if(prev_arch == arch)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
prev_arch = arch;
|
||||
|
||||
//look up the closest virtual architecture, if the arch we are building
|
||||
//for is not found
|
||||
if(arch_to_compute.find(arch) != arch_to_compute.end() )
|
||||
{
|
||||
std::string compute_level = arch_to_compute[arch];
|
||||
std::cout << "--generate-code arch=" << compute_level
|
||||
<< ",code=sm_"<< arch << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
//if not found default to known highest arch, and compile to a virtual
|
||||
//arch instead of a known sm.
|
||||
std::string compute_level = arch_to_compute.rbegin()->second;
|
||||
std::cout << "--generate-code arch=" << compute_level
|
||||
<< ",code=" << compute_level << " ";
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -18,25 +18,12 @@
|
||||
## this software.
|
||||
##============================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
#setup policy rules for CMake 3.0 while we have a minimum required of 2.8.X
|
||||
if(POLICY CMP0025)
|
||||
cmake_policy(SET CMP0025 NEW)#Clang and AppleClang are different compiler ids
|
||||
cmake_policy(SET CMP0042 NEW)#Enable RPATH on OSX
|
||||
endif()
|
||||
|
||||
#setup policy rules for CMake 3.1 while we have a minimum required of 2.8.X
|
||||
if(POLICY CMP0054)
|
||||
cmake_policy(SET CMP0053 NEW)#Enable faster parser engine
|
||||
cmake_policy(SET CMP0054 NEW)#simplify if() argument expansion
|
||||
endif()
|
||||
|
||||
#setup policy rules for CMake 3.3 while we have a minimum required of 2.8.X
|
||||
if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0058 NEW)#All dependencies on built targets are declared
|
||||
cmake_policy(SET CMP0063 NEW)#Honor visibility properties for all targets
|
||||
endif()
|
||||
#We require CMake 3.3 for Modern CMake which as features such as:
|
||||
# - Better custom command support
|
||||
# - Better acting if() argument expansion
|
||||
# - Support for usage requirements
|
||||
# -
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
|
||||
project (VTKm)
|
||||
|
||||
@ -75,16 +62,11 @@ endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add flag to enable C++11 support.
|
||||
if (NOT CMAKE_VERSION VERSION_LESS "3.1")
|
||||
option(VTKm_ENABLE_CXX11 "Build VTKm using C++11" ON)
|
||||
else()
|
||||
set(VTKm_ENABLE_CXX11 OFF)
|
||||
endif()
|
||||
# If the user has requested C++11, propagate that information to CMake
|
||||
if (VTKm_ENABLE_CXX11)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_CXX_EXTENSIONS False)
|
||||
# Unless the user has explicitly stated to compile with a different standard
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_CXX_EXTENSIONS False)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@ -103,13 +85,13 @@ include(CMake/VTKmCompilerExtras.cmake)
|
||||
# Configurable Options
|
||||
option(VTKm_ENABLE_CUDA "Enable Cuda support" OFF)
|
||||
option(VTKm_ENABLE_TBB "Enable TBB support" OFF)
|
||||
option(VTKm_ENABLE_RENDERING "Enable rendering library" ON)
|
||||
option(VTKm_ENABLE_TESTING "Enable VTKm Testing" ON)
|
||||
option(VTKm_ENABLE_BENCHMARKS "Enable VTKm Benchmarking" OFF)
|
||||
option(VTKm_ENABLE_OSMESA "Enable creating the OSMesa canvas" OFF)
|
||||
|
||||
option(VTKm_BUILD_DOCUMENTATION "Build Doxygen documentation" OFF)
|
||||
option(VTKm_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(VTKm_BUILD_RENDERING "Build rendering" OFF)
|
||||
|
||||
option(VTKm_USE_DOUBLE_PRECISION
|
||||
"Use double precision for floating point calculations"
|
||||
|
@ -31,7 +31,7 @@ add_subdirectory(isosurface)
|
||||
add_subdirectory(multi_backend)
|
||||
add_subdirectory(streamline)
|
||||
add_subdirectory(tetrahedra)
|
||||
if(VTKm_BUILD_RENDERING)
|
||||
if(VTKm_ENABLE_RENDERING)
|
||||
add_subdirectory(rendering)
|
||||
endif(VTKm_BUILD_RENDERING)
|
||||
endif()
|
||||
|
||||
|
@ -60,9 +60,9 @@ endif(VTKm_ENABLE_OPENGL_INTEROP)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build rendering
|
||||
if(VTKm_BUILD_RENDERING)
|
||||
if(VTKm_ENABLE_RENDERING)
|
||||
add_subdirectory(rendering)
|
||||
endif(VTKm_BUILD_RENDERING)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#add the control and exec folders
|
||||
|
@ -93,7 +93,7 @@ struct TopologyElementTagCheck<vtkm::TopologyElementTagFace> : std::true_type
|
||||
|
||||
#define VTKM_IS_TOPOLOGY_ELEMENT_TAG(type) \
|
||||
static_assert( ::vtkm::internal::TopologyElementTagCheck<type>::value, \
|
||||
"Invalid Topology Element Tag being used");
|
||||
"Invalid Topology Element Tag being used")
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
@ -533,7 +533,6 @@ protected:
|
||||
std::string arrayName, dataType;
|
||||
this->DataFile->Stream >> arrayName >> numComponents >> numTuples
|
||||
>> dataType >> std::ws;
|
||||
|
||||
this->DoSkipDynamicArray(dataType, numTuples, numComponents);
|
||||
}
|
||||
}
|
||||
@ -600,9 +599,25 @@ protected:
|
||||
void DoSkipDynamicArray(std::string dataType, std::size_t numElements,
|
||||
vtkm::IdComponent numComponents)
|
||||
{
|
||||
vtkm::io::internal::DataType typeId = vtkm::io::internal::DataTypeId(dataType);
|
||||
vtkm::io::internal::SelectTypeAndCall(typeId, numComponents,
|
||||
SkipDynamicArray(this, numElements));
|
||||
// string is unsupported for SkipDynamicArray, so it requires some
|
||||
// special handling
|
||||
if(dataType == "string")
|
||||
{
|
||||
const vtkm::Id stringCount =
|
||||
numComponents * static_cast<vtkm::Id>(numElements);
|
||||
for(vtkm::Id i = 0; i < stringCount; ++i)
|
||||
{
|
||||
std::string trash;
|
||||
this->DataFile->Stream >> trash;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkm::io::internal::DataType typeId = vtkm::io::internal::DataTypeId(dataType);
|
||||
vtkm::io::internal::SelectTypeAndCall(typeId, numComponents,
|
||||
SkipDynamicArray(this, numElements));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DoReadDynamicArray(std::string dataType, std::size_t numElements,
|
||||
|
@ -38,6 +38,7 @@ namespace rendering {
|
||||
// 6. added explicit casts to remove compiler warnings
|
||||
// 7. renamed a function argument to avoid a shadowing warning
|
||||
// 8. default argument removed (moved to header prototype declaration)
|
||||
// 9. initialized info.width/height to remove unititalized value warnings
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -299,6 +300,7 @@ int DecodePNG(std::vector<unsigned char>& out_image, unsigned long& image_width,
|
||||
void decode(std::vector<unsigned char>& out, const unsigned char* in, std::size_t size, bool convert_to_rgba32_flag)
|
||||
{
|
||||
error = 0;
|
||||
info.width = 0; info.height = 0; //changed if header read successfully
|
||||
if(size == 0 || in == 0) { error = 48; return; } //the given data is empty
|
||||
readPngHeader(&in[0], size); if(error) return;
|
||||
std::size_t pos = 33; //first byte of the first chunk after the header
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
|/ |/ |/
|
||||
0----------1 |__ x
|
||||
*/
|
||||
vtkm::Vec<vtkm::Float32,3> bottomLeft;
|
||||
vtkm::Vec<vtkm::Float32,3> bottomLeft(0);
|
||||
bool newCell = true;
|
||||
//check to see if we left the cell
|
||||
vtkm::Float32 tx = 0.f;
|
||||
|
Loading…
Reference in New Issue
Block a user