Skip to content

Instantly share code, notes, and snippets.

View robertmaynard's full-sized avatar

Robert Maynard robertmaynard

View GitHub Profile
@robertmaynard
robertmaynard / example.cmake
Created January 24, 2022 19:21
mutliple thrust find_package bug
cmake_minimum_required(VERSION 3.20)
project(find_thrust)
file(DOWNLOAD https://github.com/NVIDIA/thrust/archive/refs/tags/1.12.0.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/thrust-1.12.tar.gz)
file(DOWNLOAD https://github.com/NVIDIA/cub/archive/refs/tags/1.12.0.tar.gz
${CMAKE_CURRENT_BINARY_DIR}/cub-1.12.tar.gz)
file(DOWNLOAD https://github.com/NVIDIA/thrust/archive/refs/tags/1.15.0.tar.gz
@robertmaynard
robertmaynard / script.sh
Created September 2, 2020 17:19
building vtk-m with kokkos + hip
# build a simple vtk-m example
git clone --single-branch --branch experimental_hip_support https://gitlab.kitware.com/robertmaynard/vtk-m.git
# build just the bits of vtk-m that work with hip
cmake -S src/ -B build_hip/ \
-DVTKm_ENABLE_KOKKOS=ON \
-DCMAKE_PREFIX_PATH=<kokkos_install_dir>
# build a simple vtk-m example
@robertmaynard
robertmaynard / CMakeLists.txt
Created December 19, 2018 16:18
cmp0077 warning
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
project(Example)
cmake_policy(SET CMP0077 NEW)
set(OPT_LOCAL_VAR FALSE)
option(OPT_LOCAL_VAR "TEST_VAR" ON)
if(OPT_LOCAL_VAR)
message(STATUS "option failed to overwrite existing normal variable")
endif()
@robertmaynard
robertmaynard / log.txt
Created December 3, 2018 18:28
verify cmake spack downloads from github
robert@forge:~/Work/spack$ git log -n1
commit 73a70b33ae68d7b38d3c69cb198fb33e70a76b6b (HEAD -> get_cmake_from_github, github/get_cmake_from_github)
Author: Robert Maynard <robert.maynard@kitware.com>
Date: Mon Dec 3 11:10:30 2018 -0500
Download CMake sources from the Github releases
Now that CMake is providing CMake release artifacts on github,
we should prefer those as they have better download speeds and
uptime.
@robertmaynard
robertmaynard / build_tests.txt
Last active August 16, 2018 13:18
cuRand and thrust example error
nvcc -std=c++11 -arch=sm_30 -c main.cu [works]
nvcc -std=c++11 -arch=sm_32 -c main.cu [works]
nvcc -std=c++11 -arch=sm_35 -c main.cu [works]
nvcc -std=c++11 -arch=sm_50 -c main.cu [works]
nvcc -std=c++11 -arch=sm_60 -c main.cu [works]
nvcc -std=c++11 -arch=sm_70 -c main.cu [works]
nvcc -std=c++11 -arch=sm_30 -dc main.cu [works]
@robertmaynard
robertmaynard / errors.log
Created August 10, 2018 12:50
CUDA 9 fails with local type
/home/robert/Work/local_type/src/main.cu(50): warning: calling a __host__ function from a __host__ __device__ function is not allowed
detected during instantiation of "int64_t vtkm::copy_if(InputIterator, InputIterator, Stencil, OutputIterator, UnaryPredicate) [with InputIterator=thrust::detail::normal_iterator<thrust::device_ptr<float>>, Stencil=thrust::detail::normal_iterator<thrust::device_ptr<uint8_t>>, OutputIterator=thrust::detail::normal_iterator<thrust::device_ptr<float>>, UnaryPredicate=InComplete]"
(73): here
/home/robert/Work/local_type/src/main.cu(70): warning: calling a __host__ function("thrust::device_vector<float, ::thrust::device_malloc_allocator<float> > ::device_vector") from a __host__ __device__ function("Task::operator () const") is not allowed
/home/robert/Work/local_type/src/main.cu(71): warning: calling a __host__ function("thrust::device_vector<unsigned char, ::thrust::device_malloc_allocator<unsigned char> > ::device_vector") from a __host__ __device__ function("Task:
if (NOT DEFINED PROJ_INSTALL_INCLUDE_DIR)
set(PROJ_INSTALL_INCLUDE_DIR "include/vtkm-${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}")
endif()
if (NOT DEFINED PROJ_INSTALL_CONFIG_DIR)
set(PROJ_INSTALL_CONFIG_DIR "lib/cmake/vtkm-${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}")
endif()
if (NOT DEFINED PROJ_INSTALL_LIB_DIR)
set(PROJ_INSTALL_LIB_DIR "lib")
endif()
if (NOT DEFINED PROJ_INSTALL_BIN_DIR)
@robertmaynard
robertmaynard / example.cmake
Created March 19, 2018 12:47
CMakeMakeAbsPaths.cmake
function(add_to_list variable_name)
#variable_name holds the name of the variable that we need to set
#so ${variable} == name, ${${variable}} == contents of said variable
message(STATUS "adding to variable ${variable_name}")
set(srcs )
foreach(source_file ${ARGN})
list(APPEND srcs "${CMAKE_CURRENT_SOURCE_DIR}/${source_file}")
endforeach()
#Functions have local scope so we need to set the callers version of the
@robertmaynard
robertmaynard / gist:b4c1edaf9c8896fea877ff571e899f80
Created December 14, 2017 14:50
CMake switch impl on fpic
add_library(I INTERFACE)
add_library(IA STATIC impl1.cpp)
set_target_properties(IA PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(IB STATIC impl2.cpp)
set(has_iface "$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>")
@robertmaynard
robertmaynard / Example.cu
Created November 30, 2017 20:22
cuda9_nvlink_msvc
int main()
{
return 0;
}