Thrust (cuda version 8) compiling with lots of noise on Windows 10?

So, this is one of my source files and I’m getting quite a few warnings from the internal Thrust implementations.

#include "globals.hpp"
#include "lib/nominate.hpp"

#include <thrust/device_vector.h>
#include <thrust/fill.h>
#include <thrust/tuple.h>
#include <thrust/sort.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/unique.h>
#include <thrust/for_each.h>
#include <thrust/pair.h>
#include <thrust/distance.h>
#include <thrust/transform.h>

using thrust::device_vector;
using thrust::fill;
using thrust::tuple;
using thrust::get;
using thrust::make_zip_iterator;
using thrust::make_tuple;
using thrust::sort;
using thrust::unique_by_key_copy;
using thrust::for_each;
using thrust::pair;
using thrust::distance;
using thrust::transform;

  * This function is used to determine which points will
  * be used in this round of insertion.
  * nm is an array aligned to the number of points that
  * are available
  * pa, ta, la are the association tuple

auto nominate(
  long long const assoc_size,
  thrust::device_vector<long long>& pa,
  thrust::device_vector<long long>& ta,
  thrust::device_vector<long long>& la,
  thrust::device_vector<long long>& nm) -> void
  // the first thing we want to do is sort everything
  // by ta
  auto zip_begin =
    zip_begin, zip_begin + assoc_size,
    [] __device__ (
      tuple<long long, long long, long long> const& a,
      tuple<long long, long long, long long> const& b) -> bool
      long long const a_ta_id{get<1>(a)};
      long long const a_pa_id{get<0>(a)};
      long long const b_ta_id{get<1>(b)};
      long long const b_pa_id{get<0>(b)};
      return a_ta_id == b_ta_id ? a_pa_id < b_pa_id : a_ta_id < b_ta_id;
  // we then want to allocate copies of our
  // association arrays to write our stream
  // compaction to
  device_vector<long long> pa_cpy{static_cast<unsigned long long>(assoc_size), -1};
  device_vector<long long> ta_cpy{static_cast<unsigned long long>(assoc_size), -1};
  // remove tuple elements, using ta as the
  // unique key
  auto last_pair = unique_by_key_copy(
    ta.begin(), ta.begin() + assoc_size,

  // unique_by_key_copy returns a pair of iterators (keys_last, values_last)
  long long const assoc_cpy_size{static_cast<long long>(distance(ta_cpy.begin(), last_pair.first))};
  fill(nm.begin(), nm.end(), 0);
  device_vector<long long> nm_cpy{nm};
  long long* nm_data =;
  long long* nm_cpy_data =;
  // this is how we count the number of occurrences for a particular
  // point index
  // if the copy doesn't match up with the original count array, that
  // means that the point had some non-unique tetrahedra associated
  // with it and as such is not up for nomination
    pa.begin(), pa.begin() + assoc_size,
    [=] __device__ (long long const pa_id) -> void
      atomicAdd(reinterpret_cast<unsigned long long*>(nm_data + pa_id), 1);
    pa_cpy.begin(), pa_cpy.begin() + assoc_cpy_size,
    [=] __device__ (long long const pa_id) -> void
      atomicAdd(reinterpret_cast<unsigned long long*>(nm_cpy_data + pa_id), 1);
  // we perform a simple transformation over both ranges and
  // check for equality.
  // if the point occurred the same amount of times then all
  // of its  tetrahedra were unique and is able to be nominated
    nm.begin(), nm.end(),
    [] __device__ (long long const a, long long const b) -> long long
      return (a != 0) && (a - b == 0);

These are the errors that I’m getting:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/system/cuda/detail/detail/stable_sort_each.inl(299): warning C4244: 'initializing': conversion from 'difference_type' t
       o 'int', possible loss of data [C:\Users\christian\cuda\cuda-stuff\build-debug\regulus.vcxproj]
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/function.h(60): warning C4800: 'const int': forcing value to bool 'true' or 'false' (performance warning) [C:\Us
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/function.h(96): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) [C:\Users\ch
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/function.h(87): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) [C:\Users\ch
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/internal_functional.h(322): warning C4244: '=': conversion from '__int64' to 'unsigned int', possible loss of da
       ta [C:\Users\christian\cuda\cuda-stuff\build-debug\regulus.vcxproj]
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/system/cuda/detail/detail/stable_merge_sort.inl(313): warning C4319: '~': zero extending 'unsigned int' to '__int64' of
        greater size [C:\Users\christian\cuda\cuda-stuff\build-debug\regulus.vcxproj]
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/system/cuda/detail/detail/stable_merge_sort.inl(328): warning C4244: 'argument': conversion from '__int64' to 'const un
       signed int', possible loss of data [C:\Users\christian\cuda\cuda-stuff\build-debug\regulus.vcxproj]
         C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\thrust/system/detail/generic/sequence.inl(48): warning C4244: 'return': conversion from '__int64' to 'unsigned int', possible
       loss of data [C:\Users\christian\cuda\cuda-stuff\build-debug\regulus.vcxproj]

This is a link to the project for reference. The file is right here. Not all the source files are being built right now.

Is there something I’m missing?

These warnings are presumably not correlated with the OS version, but with the host compiler version or specific warning switches enabled with the host compiler.

Some of these warnings seem like they are for very minor stuff, are you building with /W4 by any chance? If so, I would suggest reducing to /W3.

Another hypothesis is that you recently switched to VS2015, and that it may have added new warnings to /Wall. I know this latter effect mostly from gcc, which kept adding what I consider predominantly useless warnings to -Wall in the past 10 years, wasting programmer time for needless (IMHO) cleanup operations, to keep builds working with /Wall /WX

Ugh, I had to drop down to /W2 to get it to get the warnings to disappear. The default was /W3. And then I got a lot more warnings about switching from /W3 to /W2 lol XD

Hmm… I’m going to just live with the warnings, I suppose. msvc is notoriously dumb and my code works fine. Alright, I feel better now lol. Cross-platform development is interesting.

Posting build script just for reference (just in case):

cmake -G "Visual Studio 14 2015 Win64" ..\debug;
# lame but msbuild can't seem to parallelize
# these builds... 
# but we still try anyway!
msbuild /maxcpucount:4 regulus.sln

Last I checked Thrust was a supported library that ships with CUDA. Consider raising the issue with NVIDIA in the form of an RFE (enhancement request), which can be filed via the regular bug reporting form linked from the CUDA registered developer website.

With MSVC the use of /W3 (and keeping builds free of warnings at that level) seems entirely reasonable to me as twenty-year user of that tool chain. I am not familiar with MSVS 2015. The problem may be that Microsoft added new warnings to that level in MSVS 2015, or bumped existing warnings from /W4 to /W3. Again, that seems to be a general trend, and I am not happy about it: I want warnings that alert on issues likely to cause serious problems, not ones that are unlikely to be a problem ever. There are separate lint tools (or /W4) if one wants that functionality.