Alpine-DAV/vtk-h

VTK-h does not build

NAThompson opened this issue · 3 comments

Given the following VTK-m commit:

vtk-m$ git log
commit 77f17450ba8bfbe09a9570ef9c5cdc275061f34f (HEAD)

which is built (successfully) with the following flags:

build_vtk-m$ cmake -DVTKm_ENABLE_CUDA=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.1/bin/nvcc -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DVTKm_ENABLE_TESTING=OFF ../vtk-m/

then VTK-h does not compile successfully, using the following cmake flags:

build_vtk-h$  ~/Downloads/cmake-3.15.0-Linux-x86_64/bin/cmake -DENABLE_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DVTKm_DIR=/usr/local/include/vtkm-1.4 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.1/bin/nvcc -DVTKM_DIR=~/build_vtk-m/ ../vtk-h/src

The error message being:

build_vtk-h$ make
[ 23%] Building CUDA object vtkh/filters/CMakeFiles/vtkh_filters_mpi.dir/Slice.cpp.o
/home/4nt/vtk-m/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h(55): error #312: no suitable user-defined conversion from "vtkm::internal::ArrayPortalValueReference<vtkm::ArrayPortalRef<vtkm::Vec<vtkm::Float32, 3>>>" to "OutputType" exists
          detected during:
            instantiation of "void vtkm::cont::DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagSerial>::DoCopy(InIter, InIter, OutIter, std::false_type) [with InIter=vtkm::cont::internal::IteratorFromArrayPortal<vtkm::ArrayPortalRef<vtkm::Vec<vtkm::Float32, 3>>>, OutIter=vtkm::Vec<vtkm::Float64, 3> *]" 
(186): here
            instantiation of "__nv_bool vtkm::cont::DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagSerial>::CopySubRange(const vtkm::cont::ArrayHandle<T, CIn> &, vtkm::Id, vtkm::Id, vtkm::cont::ArrayHandle<U, COut> &, vtkm::Id) [with T=vtkm::Vec<vtkm::Float32, 3>, U=vtkm::Vec<vtkm::Float64, 3>, CIn=vtkm::cont::StorageTagVirtual, COut=vtkm::cont::StorageTagBasic]" 
/home/4nt/vtk-m/vtkm/cont/Algorithm.h(106): here
            instantiation of "__nv_bool vtkm::cont::detail::CopySubRangeFunctor::operator()(Device, Args &&...) [with Device=vtkm::cont::DeviceAdapterTagSerial, Args=<const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>, vtkm::cont::StorageTagVirtual> &, vtkm::Id &, vtkm::Id &, vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, vtkm::cont::StorageTagBasic> &, vtkm::Id &>]" 
/home/4nt/vtk-m/vtkm/cont/TryExecute.h(43): here
            instantiation of "__nv_bool vtkm::cont::detail::TryExecuteIfValid(std::true_type, DeviceTag, Functor &&, vtkm::cont::DeviceAdapterId, vtkm::cont::RuntimeDeviceTracker &, Args &&...) [with DeviceTag=vtkm::cont::DeviceAdapterTagSerial, Functor=vtkm::cont::detail::CopySubRangeFunctor &, Args=<const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>, vtkm::cont::StorageTagVirtual> &, vtkm::Id &, vtkm::Id &, vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, vtkm::cont::StorageTagBasic> &, vtkm::Id &>]" 
/home/4nt/vtk-m/vtkm/cont/TryExecute.h(83): here
            instantiation of "void vtkm::cont::detail::TryExecuteWrapper::operator()(DeviceTag, Functor &&, vtkm::cont::DeviceAdapterId, vtkm::cont::RuntimeDeviceTracker &, __nv_bool &, Args &&...) const [with DeviceTag=vtkm::cont::DeviceAdapterTagSerial, Functor=vtkm::cont::detail::CopySubRangeFunctor &, Args=<const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>, vtkm::cont::StorageTagVirtual> &, vtkm::Id &, vtkm::Id &, vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, vtkm::cont::StorageTagBasic> &, vtkm::Id &>]" 
/home/4nt/vtk-m/vtkm/internal/ListTagDetail.h(198): here
            [ 2 instantiation contexts not shown ]
            instantiation of "__nv_bool vtkm::cont::detail::TryExecuteImpl(vtkm::cont::DeviceAdapterId, Functor &&, std::false_type, Args &&...) [with Functor=vtkm::cont::detail::CopySubRangeFunctor &, Args=<const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>, vtkm::cont::StorageTagVirtual> &, vtkm::Id &, vtkm::Id &, vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, vtkm::cont::StorageTagBasic> &, vtkm::Id &>]" 
/home/4nt/vtk-m/vtkm/cont/TryExecute.h(190): here
            instantiation of "__nv_bool vtkm::cont::TryExecuteOnDevice(vtkm::cont::DeviceAdapterId, Functor &&, Arg1 &&, Args &&...) [with Functor=vtkm::cont::detail::CopySubRangeFunctor &, Arg1=const vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>, vtkm::cont::StorageTagVirtual> &, Args=<vtkm::Id &, vtkm::Id &, vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>, vtkm::cont::StorageTagBasic> &, vtkm::Id &>]" 
/home/4nt/vtk-m/vtkm/cont/Algorithm.h(500): here
            instantiation of "__nv_bool vtkm::cont::Algorithm::CopySubRange(vtkm::cont::DeviceAdapterId, const vtkm::cont::ArrayHandle<T, CIn> &, vtkm::Id, vtkm::Id, vtkm::cont::ArrayHandle<U, COut> &, vtkm::Id) [with T=vtkm::Vec<vtkm::Float32, 3>, U=vtkm::Vec<vtkm::Float64, 3>, CIn=vtkm::cont::StorageTagVirtual, COut=vtkm::cont::StorageTagBasic]" 
/home/4nt/vtk-m/vtkm/cont/Algorithm.h(515): here
            instantiation of "__nv_bool vtkm::cont::Algorithm::CopySubRange(const vtkm::cont::ArrayHandle<T, CIn> &, vtkm::Id, vtkm::Id, vtkm::cont::ArrayHandle<U, COut> &, vtkm::Id) [with T=vtkm::Vec<vtkm::Float32, 3>, U=vtkm::Vec<vtkm::Float64, 3>, CIn=vtkm::cont::StorageTagVirtual, COut=vtkm::cont::StorageTagBasic]" 
/home/4nt/vtk-h/src/vtkh/filters/Slice.cpp(124): here
            instantiation of "void vtkh::detail::MergeContours::CopyCoords(vtkm::cont::ArrayHandleVirtual<vtkm::Vec<T, 3>> &, vtkm::cont::ArrayHandle<vtkm::Vec<U, 3>, vtkm::cont::StorageTagBasic> &, vtkm::Id) [with T=vtkm::Float32, U=vtkm::Float64]" 
/home/4nt/vtk-h/src/vtkh/filters/Slice.cpp(285): here

1 error detected in the compilation of "/tmp/tmpxft_0000275d_00000000-6_Slice.cpp1.ii".
vtkh/filters/CMakeFiles/vtkh_filters_mpi.dir/build.make:283: recipe for target 'vtkh/filters/CMakeFiles/vtkh_filters_mpi.dir/Slice.cpp.o' failed
make[2]: *** [vtkh/filters/CMakeFiles/vtkh_filters_mpi.dir/Slice.cpp.o] Error 1
CMakeFiles/Makefile2:1596: recipe for target 'vtkh/filters/CMakeFiles/vtkh_filters_mpi.dir/all' failed
make[1]: *** [vtkh/filters/CMakeFiles/vtkh_filters_mpi.dir/all] Error 2
Makefile:140: recipe for target 'all' failed

Additional information:

$ /usr/local/cuda-10.1/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Apr_24_19:10:27_PDT_2019
Cuda compilation tools, release 10.1, V10.1.168
$ g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Using Ubuntu 18.04.

You need a few more build flags when building vtk-m:

-DVTKm_USE_64BIT_IDS=OFF -DVTKm_USE_DOUBLE_PRECISION=ON

Source:
https://ascent.readthedocs.io/en/latest/BuildingAscent.html#building-ascent-dependencies-manually

Ok, I got it compiled by adding @jameskress 's suggested flags.

Is there a fundamental reason why I have to recompile my dependencies to a specific commit and use a large number of custom flags? It seems to me that if this is how the library must be used then adding VTK-m as a git submodule is sensible.

The reason why we have to use a specific commit is b/c the VTK-m API is in flux and as of right now we can't use any of the named releases. Upgrading is a deliberate process that is extensively tested before we move. They reason for the custom flags is we don't control the VTK-m's default choices for things like types used or the templates that are available for downstream use etc. The defaults don't meet the needs for the use cases we are supporting down stream in Ascent.

A submodule would help with the exact version, but it's not clear the cmake build systems of the two libraries could be fused to make a submodule approach seamless.

We mostly build with spack via an automated process, that is also how we test the entire stack.

We have documented as much of these details as possible, but the focus is the Ascent docs.