Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Replace allocator and vector classes with alias templates #1221

Merged
merged 1 commit into from Jul 28, 2020

Conversation

mfrancis95
Copy link
Contributor

Files affected:

  • thrust/system/cpp/memory.h
  • thrust/system/cuda/memory.h
  • thrust/system/cuda/vector.h
  • thrust/system/omp/memory.h
  • thrust/system/tbb/memory.h
  • thrust/system/tbb/vector.h

Copy link
Collaborator

@alliepiper alliepiper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this was on my todo list now that C++03 is gone 👍 The patch is very appreciated!

This still needs a bit of work to compile, see the inline comments. #1163 (which I will finish and get merged this week) describes how to build and run the Thrust tests.

Also -- since you're tackling C++11 modernization stuff, just be aware of #1152 so we aren't duplicating work.

thrust/system/cuda/memory.h Outdated Show resolved Hide resolved
thrust/system/cuda/vector.h Show resolved Hide resolved
thrust/system/tbb/vector.h Show resolved Hide resolved
@mfrancis95
Copy link
Contributor Author

mfrancis95 commented Jul 6, 2020

@allisonvacanti I'll tackle those requests. My concern is that this conflicts with #1152 because @brycelelbach modified the same files I modified but simply removed the CPP11 macros instead of replacing the classes with alias templates altogether.

Additionally, I'm curious as to what you do to build it and see the errors that you see because from my end things were compiling cleanly. Would like to align my build process with what you have so we don't get these issues in the future.

@alliepiper
Copy link
Collaborator

@allisonvacanti I'll tackle those requests. My concern is that this conflicts with #1152 because @brycelelbach modified the same files I modified but simply removed the CPP11 macros instead of replacing the classes with alias templates altogether.

That's ok, 1152 is a rough pass that just removes the now-obsolete preprocessor checks -- your patch is a better solution for these files. We'll rebase 1152 once we get back to working on it.

Additionally, I'm curious as to what you do to build it and see the errors that you see because from my end things were compiling cleanly. Would like to align my build process with what you have so we don't get these issues in the future.

I have a dedicated workstation set up to build all 36 combinations of HOST={cpp,omp,tbb} DEVICE={cpp,omp,tbb,cuda} DIALECT={11,14,17} on GCC 7.5.0 using the multiconfig cmake options. I use this as a temporary measure until we have better CI in place. I need to update the docs to describe multiconfig, but the linked file lays out the options and underlying logic.

My CMake options:

 CMAKE_BUILD_TYPE                 Release
 THRUST_DISABLE_ARCH_BY_DEFAULT   ON
 THRUST_ENABLE_COMPUTE_60         ON
 THRUST_ENABLE_COMPUTE_70         ON
 THRUST_ENABLE_COMPUTE_FUTURE     OFF
 THRUST_ENABLE_EXAMPLES           ON
 THRUST_ENABLE_EXAMPLES_WITH_RDC   ON
 THRUST_ENABLE_EXAMPLE_FILECHECK   ON
 THRUST_ENABLE_HEADER_TESTING     ON
 THRUST_ENABLE_MULTICONFIG        ON
 THRUST_ENABLE_TESTING            ON
 THRUST_ENABLE_TESTS_WITH_RDC     ON
 THRUST_FILECHECK_EXECUTABLE      /usr/bin/FileCheck-9
 THRUST_MULTICONFIG_ENABLE_DIALECT_CPP11   ON
 THRUST_MULTICONFIG_ENABLE_DIALECT_CPP14   ON
 THRUST_MULTICONFIG_ENABLE_DIALECT_CPP17   ON
 THRUST_MULTICONFIG_ENABLE_SYSTEM_CPP   ON
 THRUST_MULTICONFIG_ENABLE_SYSTEM_OMP   ON
 THRUST_MULTICONFIG_ENABLE_SYSTEM_TBB   ON
 THRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA   ON
 THRUST_MULTICONFIG_WORKLOAD      FULL

It can take up to 12 hours to fully build this on good hardware, so you'll probably want to scale things back or just stick with the single configuration build (THRUST_MULTICONFIG_ENABLED=OFF) and probe the specific configurations that are failing.

Alternatively, configure multiconfig and just compile/test a single configuration with (for example) ninja thrust.cpp.cuda.cpp14.all and ctest -R thrust.cpp.cuda.cpp14

The failing configurations (thrust.host.device.dialect) are the non-zero exit status ones below. The hit/miss stats can be ignored, they're for ccache.

Building thrust.cpp.cpp.cpp11...   Walltime:   0:16.33 |    49 CPU secs | ExitCode:   0 |  98% Hit* | 4/317 Miss
Building thrust.cpp.cpp.cpp14...   Walltime:   0:06.26 |    41 CPU secs | ExitCode:   0 |  98% Hit* | 4/317 Miss
Building thrust.cpp.cpp.cpp17...   Walltime:   0:06.38 |    42 CPU secs | ExitCode:   0 |  98% Hit* | 4/317 Miss
Building thrust.cpp.omp.cpp11...   Walltime:   0:06.62 |    45 CPU secs | ExitCode:   0 |  98% Hit* | 6/323 Miss
Building thrust.cpp.omp.cpp14...   Walltime:   0:06.75 |    45 CPU secs | ExitCode:   0 |  98% Hit* | 6/323 Miss
Building thrust.cpp.omp.cpp17...   Walltime:   0:06.97 |    46 CPU secs | ExitCode:   0 |  98% Hit* | 6/323 Miss
Building thrust.cpp.tbb.cpp11...   Walltime:   0:01.60 |     9 CPU secs | ExitCode:   1 |  79% Hit* | 14/69 Miss
Building thrust.cpp.tbb.cpp14...   Walltime:   0:12.66 |    74 CPU secs | ExitCode:   1 |  72% Hit* | 35/129 Miss
Building thrust.cpp.tbb.cpp17...   Walltime:   0:19.98 |   101 CPU secs | ExitCode:   1 |  73% Hit* | 34/128 Miss
Building thrust.omp.cpp.cpp11...   Walltime:   0:07.12 |    44 CPU secs | ExitCode:   0 |  98% Hit* | 6/322 Miss
Building thrust.omp.cpp.cpp14...   Walltime:   0:07.36 |    45 CPU secs | ExitCode:   0 |  98% Hit* | 6/322 Miss
Building thrust.omp.cpp.cpp17...   Walltime:   0:07.24 |    46 CPU secs | ExitCode:   0 |  98% Hit* | 6/322 Miss
Building thrust.omp.omp.cpp11...   Walltime:   0:07.64 |    45 CPU secs | ExitCode:   0 |  98% Hit* | 4/318 Miss
Building thrust.omp.omp.cpp14...   Walltime:   0:07.61 |    46 CPU secs | ExitCode:   0 |  98% Hit* | 4/318 Miss
Building thrust.omp.omp.cpp17...   Walltime:   0:07.82 |    46 CPU secs | ExitCode:   0 |  98% Hit* | 4/318 Miss
Building thrust.omp.tbb.cpp11...   Walltime:   0:38.92 |   154 CPU secs | ExitCode:   1 |  71% Hit* | 37/130 Miss
Building thrust.omp.tbb.cpp14...   Walltime:   0:25.41 |   147 CPU secs | ExitCode:   1 |  66% Hit* | 47/140 Miss
Building thrust.omp.tbb.cpp17...   Walltime:   0:27.99 |   226 CPU secs | ExitCode:   1 |  71% Hit* | 37/130 Miss
Building thrust.tbb.cpp.cpp11...   Walltime:   0:24.23 |   142 CPU secs | ExitCode:   1 |  72% Hit* | 36/130 Miss
Building thrust.tbb.cpp.cpp14...   Walltime:   0:23.93 |   152 CPU secs | ExitCode:   1 |  72% Hit* | 36/130 Miss
Building thrust.tbb.cpp.cpp17...   Walltime:   0:26.44 |   134 CPU secs | ExitCode:   1 |  72% Hit* | 36/130 Miss
Building thrust.tbb.omp.cpp11...   Walltime:   0:39.00 |   128 CPU secs | ExitCode:   1 |  71% Hit* | 37/130 Miss
Building thrust.tbb.omp.cpp14...   Walltime:   0:26.10 |   154 CPU secs | ExitCode:   1 |  71% Hit* | 37/130 Miss
Building thrust.tbb.omp.cpp17...   Walltime:   0:28.13 |   150 CPU secs | ExitCode:   1 |  71% Hit* | 37/130 Miss
Building thrust.tbb.tbb.cpp11...   Walltime:   0:23.33 |   115 CPU secs | ExitCode:   1 |  72% Hit* | 34/125 Miss
Building thrust.tbb.tbb.cpp14...   Walltime:   0:32.30 |   138 CPU secs | ExitCode:   1 |  73% Hit* | 33/124 Miss
Building thrust.tbb.tbb.cpp17...   Walltime:   0:34.36 |   171 CPU secs | ExitCode:   1 |  72% Hit* | 34/125 Miss
Building thrust.cpp.cuda.cpp11...  Walltime:   0:04.74 |    27 CPU secs | ExitCode:   1 |  96% Hit* | 4/122 Miss
Building thrust.cpp.cuda.cpp14...  Walltime:   0:04.87 |    28 CPU secs | ExitCode:   1 |  96% Hit* | 4/128 Miss
Building thrust.cpp.cuda.cpp17...  Walltime:   0:05.48 |    28 CPU secs | ExitCode:   1 |  97% Hit* | 4/134 Miss
Building thrust.omp.cuda.cpp11...  Walltime:   0:05.02 |    28 CPU secs | ExitCode:   1 |  96% Hit* | 4/125 Miss
Building thrust.omp.cuda.cpp14...  Walltime:   0:08.40 |    31 CPU secs | ExitCode:   1 |  96% Hit* | 4/123 Miss
Building thrust.omp.cuda.cpp17...  Walltime:   0:05.38 |    29 CPU secs | ExitCode:   1 |  96% Hit* | 4/124 Miss
Building thrust.tbb.cuda.cpp11...  Walltime:   0:05.83 |    43 CPU secs | ExitCode:   1 |  56% Hit* | 14/32 Miss
Building thrust.tbb.cuda.cpp14...  Walltime:   0:05.86 |    44 CPU secs | ExitCode:   1 |  56% Hit* | 14/32 Miss
Building thrust.tbb.cuda.cpp17...  Walltime:   0:48.09 |    86 CPU secs | ExitCode:   1 |  54% Hit* | 14/31 Miss

@brycelelbach brycelelbach added this to the 1.10.0 milestone Jul 10, 2020
@brycelelbach brycelelbach changed the base branch from master to main July 11, 2020 04:19
@mfrancis95 mfrancis95 force-pushed the cpp11 branch 2 times, most recently from 1dec8ba to 6132212 Compare July 12, 2020 13:16
@mfrancis95
Copy link
Contributor Author

@allisonvacanti I force-pushed the corrections. All vector.inl files have been deleted.

@alliepiper
Copy link
Collaborator

Looks good to me, just need to fix up the missing newlines at the ends of the vector.h files.

Rerunning local tests now.

@alliepiper
Copy link
Collaborator

Rebased on current main and addressed the newlines while launching CI.

Perforce CL 28805798

@alliepiper alliepiper self-requested a review July 14, 2020 13:12
@alliepiper alliepiper added testing: gpuCI passed Passed gpuCI testing. testing: internal ci in progress Currently testing on internal NVIDIA CI (DVS). labels Jul 14, 2020
Delete /detail/vector.inl files since they are no longer needed.

Files affected:

- thrust/system/cpp/memory.h
- thrust/system/cpp/vector.h
- thrust/system/cuda/memory.h
- thrust/system/cuda/vector.h
- thrust/system/omp/memory.h
- thrust/system/omp/vector.h
- thrust/system/tbb/memory.h
- thrust/system/tbb/vector.h
@alliepiper
Copy link
Collaborator

new CL after rebase: 28854727

@alliepiper alliepiper merged commit d7da208 into NVIDIA:main Jul 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testing: gpuCI passed Passed gpuCI testing. testing: internal ci in progress Currently testing on internal NVIDIA CI (DVS).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants