diff --git a/.github/workflows/build-and-test-windows.yml b/.github/workflows/build-and-test-windows.yml deleted file mode 100644 index 2cabf9d..0000000 --- a/.github/workflows/build-and-test-windows.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build Windows - -on: - workflow_call: - inputs: - test_name: {type: string, required: false} - build_script: {type: string, required: false} - test_script: {type: string, required: false} - container_image: {type: string, required: false} - -jobs: - prepare: - name: Build Only ${{inputs.test_name}} - runs-on: windows-amd64-cpu16 - permissions: - id-token: write - contents: read - env: - SCCACHE_BUCKET: rapids-sccache-devs - SCCACHE_REGION: us-east-2 - SCCACHE_IDLE_TIMEOUT: 0 - SCCACHE_S3_USE_SSL: true - SCCACHE_S3_NO_CREDENTIALS: false - steps: - - name: Get AWS credentials for sccache bucket - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA - aws-region: us-east-2 - role-duration-seconds: 43200 # 12 hours - - name: Fetch ${{ inputs.container_image }} - shell: powershell - run: docker pull ${{ inputs.container_image }} - - name: Run the tests - shell: powershell - run: >- - docker run ${{ inputs.container_image }} powershell -c "[System.Environment]::SetEnvironmentVariable('AWS_ACCESS_KEY_ID','${{env.AWS_ACCESS_KEY_ID}}') - [System.Environment]::SetEnvironmentVariable('AWS_SECRET_ACCESS_KEY','${{env.AWS_SECRET_ACCESS_KEY}}') - [System.Environment]::SetEnvironmentVariable('AWS_SESSION_TOKEN','${{env.AWS_SESSION_TOKEN }}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_BUCKET','${{env.SCCACHE_BUCKET}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_REGION','${{env.SCCACHE_REGION}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_IDLE_TIMEOUT','${{env.SCCACHE_IDLE_TIMEOUT}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_S3_USE_SSL','${{env.SCCACHE_S3_USE_SSL}}') - [System.Environment]::SetEnvironmentVariable('SCCACHE_S3_NO_CREDENTIALS','${{env.SCCACHE_S3_NO_CREDENTIALS}}') - git clone https://github.com/NVIDIA/nvbench.git; - cd nvbench; - git fetch --all; - git checkout ${{github.ref_name}}; - ${{inputs.build_script}};" diff --git a/.github/workflows/dispatch-build-and-test.yml b/.github/workflows/dispatch-build-and-test.yml index 22ac2b2..fc82b73 100644 --- a/.github/workflows/dispatch-build-and-test.yml +++ b/.github/workflows/dispatch-build-and-test.yml @@ -6,7 +6,6 @@ on: project_name: {type: string, required: true} per_cuda_compiler_matrix: {type: string, required: true} devcontainer_version: {type: string, required: true} - is_windows: {type: boolean, required: true} permissions: contents: read @@ -20,7 +19,6 @@ jobs: permissions: id-token: write contents: read - if: ${{ !inputs.is_windows }} uses: ./.github/workflows/build-and-test-linux.yml strategy: fail-fast: false @@ -34,20 +32,3 @@ jobs: build_script: "./ci/build_${{ inputs.project_name }}.sh -cxx ${{matrix.compiler.exe}} ${{matrix.extra_build_args}}" test_script: "./ci/test_${{ inputs.project_name }}.sh -cxx ${{matrix.compiler.exe}} ${{matrix.extra_build_args}}" container_image: rapidsai/devcontainers:${{inputs.devcontainer_version}}-cpp-${{matrix.compiler.name}}${{matrix.compiler.version}}-cuda${{matrix.cuda}}-${{matrix.os}} - - build_and_test_windows: - name: build and test windows - permissions: - id-token: write - contents: read - if: ${{ inputs.is_windows }} - uses: ./.github/workflows/build-and-test-windows.yml - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(inputs.per_cuda_compiler_matrix) }} - with: - test_name: ${{matrix.cpu}}/${{matrix.compiler.name}}${{matrix.compiler.version}} - build_script: "./ci/windows/build_${{ inputs.project_name }}.ps1 ${{matrix.extra_build_args}}" - test_script: "./ci/windows/test_${{ inputs.project_name }}.ps1 ${{matrix.extra_build_args}}" - container_image: rapidsai/devcontainers:${{inputs.devcontainer_version}}-cuda${{matrix.cuda}}-${{matrix.compiler.name}}${{matrix.compiler.version}}-${{matrix.os}} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8375fca..d9977ce 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -65,7 +65,6 @@ jobs: project_name: "nvbench" per_cuda_compiler_matrix: ${{ toJSON(fromJSON(needs.compute-matrix.outputs.PER_CUDA_COMPILER_MATRIX)[ matrix.cuda_host_combination ]) }} devcontainer_version: ${{ needs.compute-matrix.outputs.DEVCONTAINER_VERSION }} - is_windows: ${{ contains(matrix.cuda_host_combination, 'cl') }} verify-devcontainers: name: Verify Dev Containers diff --git a/CMakeLists.txt b/CMakeLists.txt index 41d1d99..4f3b7c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,6 @@ include(cmake/NVBenchUtilities.cmake) # Must be first include(cmake/NVBenchClangdCompileInfo.cmake) # Must be before any targets are created include(cmake/NVBenchConfigTarget.cmake) -include(cmake/NVBenchDependentDlls.cmake) include(cmake/NVBenchExports.cmake) include(cmake/NVBenchWriteConfigHeader.cmake) include(cmake/NVBenchDependencies.cmake) diff --git a/README.md b/README.md index e740cdf..cbb29d1 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,10 @@ features: # Supported Compilers and Tools -- CMake > 2.23.1 +- CMake > 3.30.4 - CUDA Toolkit + nvcc: 11.8 and above - g++: 7 -> 14 - clang++: 14 -> 19 -- cl.exe: 2019 -> 2022 (19.29, 29.39) - Headers are tested with C++17 -> C++20. # Getting Started diff --git a/ci/matrix.yaml b/ci/matrix.yaml index ccff2a7..27f0761 100644 --- a/ci/matrix.yaml +++ b/ci/matrix.yaml @@ -25,10 +25,6 @@ llvm17: &llvm17 { name: 'llvm', version: '17', exe: 'clang++' } llvm18: &llvm18 { name: 'llvm', version: '18', exe: 'clang++' } llvm19: &llvm19 { name: 'llvm', version: '19', exe: 'clang++' } -# MSVC configs -msvc2019: &msvc2019 { name: 'cl', version: '14.29', exe: 'cl++' } -msvc2022: &msvc2022 { name: 'cl', version: '14.39', exe: 'cl++' } - # Each environment below will generate a unique build/test job # See the "compute-matrix" job in the workflow for how this is parsed and used # cuda: The CUDA Toolkit version @@ -64,5 +60,3 @@ pull_request: - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm17 } - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm18 } - {cuda: *cuda_curr_max, os: 'ubuntu22.04', cpu: 'amd64', compiler: *llvm19 } - - {cuda: *cuda_curr_max, os: 'windows2022', cpu: 'amd64', compiler: *msvc2019 } - - {cuda: *cuda_curr_max, os: 'windows2022', cpu: 'amd64', compiler: *msvc2022 } diff --git a/ci/windows/build_common.psm1 b/ci/windows/build_common.psm1 deleted file mode 100644 index 1edea63..0000000 --- a/ci/windows/build_common.psm1 +++ /dev/null @@ -1,207 +0,0 @@ - -Param( - [Parameter(Mandatory = $true)] - [Alias("std")] - [ValidateNotNullOrEmpty()] - [ValidateSet(17)] - [int]$CXX_STANDARD = 17 -) - -# We need the full path to cl because otherwise cmake will replace CMAKE_CXX_COMPILER with the full path -# and keep CMAKE_CUDA_HOST_COMPILER at "cl" which breaks our cmake script -$script:HOST_COMPILER = (Get-Command "cl").source -replace '\\','/' -$script:PARALLEL_LEVEL = (Get-WmiObject -class Win32_processor).NumberOfLogicalProcessors - -# Extract the CL version for export to build scripts: -$script:CL_VERSION_STRING = & cl.exe /? -if ($script:CL_VERSION_STRING -match "Version (\d+\.\d+)\.\d+") { - $CL_VERSION = [version]$matches[1] - Write-Host "Detected cl.exe version: $CL_VERSION" -} - -if (-not $env:CCCL_BUILD_INFIX) { - $env:CCCL_BUILD_INFIX = "" -} - -# Presets will be configured in this directory: -$BUILD_DIR = "../build/$env:CCCL_BUILD_INFIX" - -If(!(test-path -PathType container "../build")) { - New-Item -ItemType Directory -Path "../build" -} - -# The most recent build will always be symlinked to cccl/build/latest -New-Item -ItemType Directory -Path "$BUILD_DIR" -Force - -# Prepare environment for CMake: -$env:CMAKE_BUILD_PARALLEL_LEVEL = $PARALLEL_LEVEL -$env:CTEST_PARALLEL_LEVEL = 1 -$env:CUDAHOSTCXX = $HOST_COMPILER.FullName -$env:CXX = $HOST_COMPILER.FullName - -Write-Host "========================================" -Write-Host "Begin build" -Write-Host "pwd=$pwd" -Write-Host "BUILD_DIR=$BUILD_DIR" -Write-Host "CXX_STANDARD=$CXX_STANDARD" -Write-Host "CXX=$env:CXX" -Write-Host "CUDACXX=$env:CUDACXX" -Write-Host "CUDAHOSTCXX=$env:CUDAHOSTCXX" -Write-Host "NVCC_VERSION=$NVCC_VERSION" -Write-Host "CMAKE_BUILD_PARALLEL_LEVEL=$env:CMAKE_BUILD_PARALLEL_LEVEL" -Write-Host "CTEST_PARALLEL_LEVEL=$env:CTEST_PARALLEL_LEVEL" -Write-Host "CCCL_BUILD_INFIX=$env:CCCL_BUILD_INFIX" -Write-Host "Current commit is:" -Write-Host "$(git log -1)" -Write-Host "========================================" - -function configure_preset { - Param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$BUILD_NAME, - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$PRESET, - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [string]$CMAKE_OPTIONS - ) - - $step = "$BUILD_NAME (configure)" - - # CMake must be invoked in the same directory as the presets file: - pushd ".." - - $cmake_command = "cmake --preset $PRESET $CMAKE_OPTIONS --log-level VERBOSE" - echo "$cmake_command" - Invoke-Expression $cmake_command - $test_result = $LastExitCode - - If ($test_result -ne 0) { - throw "$step Failed" - } - - popd - Write-Host "$step complete." -} - -function build_preset { - Param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$BUILD_NAME, - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$PRESET - ) - - $step = "$BUILD_NAME (build)" - - # CMake must be invoked in the same directory as the presets file: - pushd ".." - - sccache_stats('Start') - - cmake --build --preset $PRESET -v - $test_result = $LastExitCode - - sccache_stats('Stop') - - echo "$step complete" - - If ($test_result -ne 0) { - throw "$step Failed" - } - - popd -} - -function test_preset { - Param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$BUILD_NAME, - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$PRESET - ) - - $step = "$BUILD_NAME (test)" - - # CTest must be invoked in the same directory as the presets file: - pushd ".." - - sccache_stats('Start') - - ctest --preset $PRESET - $test_result = $LastExitCode - - sccache_stats('Stop') - - echo "$step complete" - - If ($test_result -ne 0) { - throw "$step Failed" - } - - popd -} - -function configure_and_build_preset { - Param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$BUILD_NAME, - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$PRESET, - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [string]$CMAKE_OPTIONS - ) - - configure_preset "$BUILD_NAME" "$PRESET" "$CMAKE_OPTIONS" - build_preset "$BUILD_NAME" "$PRESET" -} - -function sccache_stats { - Param ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [ValidateSet('Start','Stop')] - [string]$MODE - ) - - $sccache_stats = sccache -s - If($MODE -eq 'Start') { - [int]$script:sccache_compile_requests = ($sccache_stats[0] -replace '[^\d]+') - [int]$script:sccache_cache_hits_cpp = ($sccache_stats[2] -replace '[^\d]+') - [int]$script:sccache_cache_hits_cuda = ($sccache_stats[3] -replace '[^\d]+') - [int]$script:sccache_cache_miss_cpp = ($sccache_stats[5] -replace '[^\d]+') - [int]$script:sccache_cache_miss_cuda = ($sccache_stats[6] -replace '[^\d]+') - } else { - [int]$final_sccache_compile_requests = ($sccache_stats[0] -replace '[^\d]+') - [int]$final_sccache_cache_hits_cpp = ($sccache_stats[2] -replace '[^\d]+') - [int]$final_sccache_cache_hits_cuda = ($sccache_stats[3] -replace '[^\d]+') - [int]$final_sccache_cache_miss_cpp = ($sccache_stats[5] -replace '[^\d]+') - [int]$final_sccache_cache_miss_cuda = ($sccache_stats[6] -replace '[^\d]+') - - [int]$total_requests = $final_sccache_compile_requests - $script:sccache_compile_requests - [int]$total_hits_cpp = $final_sccache_cache_hits_cpp - $script:sccache_cache_hits_cpp - [int]$total_hits_cuda = $final_sccache_cache_hits_cuda - $script:sccache_cache_hits_cuda - [int]$total_miss_cpp = $final_sccache_cache_miss_cpp - $script:sccache_cache_miss_cpp - [int]$total_miss_cuda = $final_sccache_cache_miss_cuda - $script:sccache_cache_miss_cuda - If ( $total_requests -gt 0 ) { - [int]$hit_rate_cpp = $total_hits_cpp / $total_requests * 100; - [int]$hit_rate_cuda = $total_hits_cuda / $total_requests * 100; - echo "sccache hits cpp: $total_hits_cpp `t| misses: $total_miss_cpp `t| hit rate: $hit_rate_cpp%" - echo "sccache hits cuda: $total_hits_cuda `t| misses: $total_miss_cuda `t| hit rate: $hit_rate_cuda%" - } else { - echo "sccache stats: N/A No new compilation requests" - } - } -} - -Export-ModuleMember -Function configure_preset, build_preset, test_preset, configure_and_build_preset, sccache_stats -Export-ModuleMember -Variable BUILD_DIR, CL_VERSION diff --git a/ci/windows/build_nvbench.ps1 b/ci/windows/build_nvbench.ps1 deleted file mode 100644 index 7240698..0000000 --- a/ci/windows/build_nvbench.ps1 +++ /dev/null @@ -1,30 +0,0 @@ - -Param( - [Parameter(Mandatory = $false)] - [Alias("cmake-options")] - [ValidateNotNullOrEmpty()] - [string]$ARG_CMAKE_OPTIONS = "" -) - -$CURRENT_PATH = Split-Path $pwd -leaf -If($CURRENT_PATH -ne "ci") { - Write-Host "Moving to ci folder" - pushd "$PSScriptRoot/.." -} - -Remove-Module -Name build_common -Import-Module $PSScriptRoot/build_common.psm1 -ArgumentList 17 - -$PRESET = "nvbench-ci" -$CMAKE_OPTIONS = "" - -# Append any arguments pass in on the command line -If($ARG_CMAKE_OPTIONS -ne "") { - $CMAKE_OPTIONS += " $ARG_CMAKE_OPTIONS" -} - -configure_and_build_preset "NVBench" "$PRESET" "$CMAKE_OPTIONS" - -If($CURRENT_PATH -ne "ci") { - popd -} diff --git a/ci/windows/test_nvbench.ps1 b/ci/windows/test_nvbench.ps1 deleted file mode 100644 index 4ee5106..0000000 --- a/ci/windows/test_nvbench.ps1 +++ /dev/null @@ -1,31 +0,0 @@ - -Param( - [Parameter(Mandatory = $false)] - [Alias("cmake-options")] - [ValidateNotNullOrEmpty()] - [string]$ARG_CMAKE_OPTIONS = "" -) - -$CURRENT_PATH = Split-Path $pwd -leaf -If($CURRENT_PATH -ne "ci") { - Write-Host "Moving to ci folder" - pushd "$PSScriptRoot/.." -} - -Remove-Module -Name build_common -Import-Module $PSScriptRoot/build_common.psm1 -ArgumentList 17 - -$PRESET = "nvbench-ci" -$CMAKE_OPTIONS = "" - -# Append any arguments pass in on the command line -If($ARG_CMAKE_OPTIONS -ne "") { - $CMAKE_OPTIONS += " $ARG_CMAKE_OPTIONS" -} - -configure_and_build_preset "NVBench" "$PRESET" "$CMAKE_OPTIONS" -test_preset "NVBench" "$PRESET" - -If($CURRENT_PATH -ne "ci") { - popd -} diff --git a/cmake/NVBenchCUPTI.cmake b/cmake/NVBenchCUPTI.cmake index 7e5bed3..ea43a7f 100644 --- a/cmake/NVBenchCUPTI.cmake +++ b/cmake/NVBenchCUPTI.cmake @@ -22,47 +22,15 @@ function(nvbench_add_cupti_dep dep_name) add_library(nvbench::${dep_name_lower} SHARED IMPORTED) - if (WIN32) - # Attempt to locate the dll in the expected location. This is necessary - # because the CUPTI dll has a versioned suffix, so we can't directly search - # for it with find_file. - file(GLOB dep_dll_path "${nvbench_cupti_root}/lib64/${dep_name_lower}*dll") - cmake_path(GET dep_dll_path FILENAME dep_dll_filename) + find_library(NVBench_${dep_name_upper}_LIBRARY ${dep_name_lower} REQUIRED + DOC "The full path to lib${dep_name_lower}.so from the CUDA Toolkit." + HINTS "${nvbench_cupti_root}/lib64" + ) + mark_as_advanced(NVBench_${dep_name_upper}_LIBRARY) - # If the dll was not found in the expected location, use a default filename as a user hint. - if (NOT dep_dll_filename) - set(dep_dll_filename ${dep_name_lower}.dll) - endif() - - # Use find_file to create a cache variable and mark the file as REQUIRED. - find_file(NVBench_${dep_name_upper}_DLL ${dep_dll_filename} REQUIRED - DOC "The full path to ${dep_name_lower}.dll from the CUDA Toolkit." - HINTS "${nvbench_cupti_root}/lib64/" - ) - mark_as_advanced(NVBench_${dep_name_upper}_DLL) - - # The .libs don't have suffixes, so we can just directly search for them. - find_library(NVBench_${dep_name_upper}_LIBRARY ${dep_name_lower}.lib REQUIRED - DOC "The full path to ${dep_name_lower}.lib from the CUDA Toolkit." - HINTS "${nvbench_cupti_root}/lib64/" - ) - mark_as_advanced(NVBench_${dep_name_upper}_LIBRARY) - - set_target_properties(nvbench::${dep_name_lower} PROPERTIES - IMPORTED_LOCATION "${NVBench_${dep_name_upper}_DLL}" - IMPORTED_IMPLIB "${NVBench_${dep_name_upper}_LIBRARY}" - ) - else() - find_library(NVBench_${dep_name_upper}_LIBRARY ${dep_name_lower} REQUIRED - DOC "The full path to lib${dep_name_lower}.so from the CUDA Toolkit." - HINTS "${nvbench_cupti_root}/lib64" - ) - mark_as_advanced(NVBench_${dep_name_upper}_LIBRARY) - - set_target_properties(nvbench::${dep_name_lower} PROPERTIES - IMPORTED_LOCATION "${NVBench_${dep_name_upper}_LIBRARY}" - ) - endif() + set_target_properties(nvbench::${dep_name_lower} PROPERTIES + IMPORTED_LOCATION "${NVBench_${dep_name_upper}_LIBRARY}" + ) endfunction() nvbench_add_cupti_dep(nvperf_target) diff --git a/cmake/NVBenchConfigTarget.cmake b/cmake/NVBenchConfigTarget.cmake index 42bfd80..9a77fac 100644 --- a/cmake/NVBenchConfigTarget.cmake +++ b/cmake/NVBenchConfigTarget.cmake @@ -33,38 +33,20 @@ function(nvbench_add_cxx_flag target_name type flag) endif() endfunction() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "/W4") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wall") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wextra") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wconversion") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Woverloaded-virtual") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wcast-qual") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wpointer-arith") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wunused-local-typedef") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wunused-parameter") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wvla") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wgnu") +nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wno-gnu-line-marker") # WAR 3916341 - if (NVBench_ENABLE_WERROR) - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "/WX") - endif() - - # Suppress warnings from CPM dependency headers: - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "/external:I${NVBench_BINARY_DIR}/_deps") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "/external:W0") - - # Suppress overly-pedantic/unavoidable warnings brought in with /W4: - # C4505: unreferenced local function has been removed - # The CUDA `host_runtime.h` header emits this for - # `__cudaUnregisterBinaryUtil`. - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "/wd4505") -else() - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wall") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wextra") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wconversion") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Woverloaded-virtual") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wcast-qual") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wpointer-arith") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wunused-local-typedef") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wunused-parameter") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wvla") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wgnu") - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Wno-gnu-line-marker") # WAR 3916341 - - if (NVBench_ENABLE_WERROR) - nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Werror") - endif() +if (NVBench_ENABLE_WERROR) + nvbench_add_cxx_flag(nvbench.build_interface INTERFACE "-Werror") endif() # Experimental filesystem library @@ -76,11 +58,6 @@ endif() if (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") # fmtlib uses llvm's _BitInt internally, which is not available when compiling through nvcc: target_compile_definitions(nvbench.build_interface INTERFACE "FMT_USE_BITINT=0") - - # NVCC + MSVC does not support unicode execution encoding, disable usages of utf-8 in fmt: - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_definitions(nvbench.build_interface INTERFACE "FMT_UNICODE=0") - endif() endif() target_compile_options(nvbench.build_interface INTERFACE @@ -99,6 +76,5 @@ function(nvbench_config_target target_name) ARCHIVE_OUTPUT_DIRECTORY "${NVBench_LIBRARY_OUTPUT_DIR}" LIBRARY_OUTPUT_DIRECTORY "${NVBench_LIBRARY_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${NVBench_EXECUTABLE_OUTPUT_DIR}" - WINDOWS_EXPORT_ALL_SYMBOLS ON # oooo pretty hammer... ) endfunction() diff --git a/cmake/NVBenchDependentDlls.cmake b/cmake/NVBenchDependentDlls.cmake deleted file mode 100644 index 1a51c87..0000000 --- a/cmake/NVBenchDependentDlls.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# By default, add dependent DLLs to the build dir on MSVC. This avoids -# a variety of runtime issues when using NVML, etc. -# This behavior can be disabled using the following options: -if (WIN32) - option(NVBench_ADD_DEPENDENT_DLLS_TO_BUILD - "Copy dependent dlls to NVBench library build location (MSVC only)." - ON - ) -else() - # These are forced off for non-MSVC builds, as $ - # will always be empty on non-dll platforms. - set(NVBench_ADD_DEPENDENT_DLLS_TO_BUILD OFF) -endif() - -function(nvbench_setup_dep_dlls target_name) - # The custom command below fails when there aren't any runtime DLLs to copy, - # so only enable it when a relevant dependency is enabled: - if (NVBench_ADD_DEPENDENT_DLLS_TO_BUILD AND - (NVBench_ENABLE_NVML OR - NVBench_ENABLE_CUPTI)) - add_custom_command(TARGET ${target_name} - POST_BUILD - COMMAND - "${CMAKE_COMMAND}" -E copy - "$" - "$" - COMMAND_EXPAND_LISTS - ) - endif() -endfunction() diff --git a/cmake/NVBenchNVML.cmake b/cmake/NVBenchNVML.cmake index 4b005f3..2413b73 100644 --- a/cmake/NVBenchNVML.cmake +++ b/cmake/NVBenchNVML.cmake @@ -4,40 +4,4 @@ if (NOT TARGET CUDA::toolkit) find_package(CUDAToolkit REQUIRED) endif() -if (WIN32) - # The CUDA:: targets currently don't provide dll locations through the - # `IMPORTED_LOCATION` property, nor are they marked as `SHARED` libraries - # (they're currently `UNKNOWN`). This prevents the `nvbench_setup_dep_dlls` - # CMake function from copying the dlls to the build / install directories. - # This is discussed in https://gitlab.kitware.com/cmake/cmake/-/issues/22845 - # and the other CMake issues it links to. - # - # We create a nvbench-specific target that configures the nvml interface as - # described here: - # https://gitlab.kitware.com/cmake/cmake/-/issues/22845#note_1077538 - # - # Use find_file instead of find_library, which would search for a .lib file. - # This is also nice because find_file searches recursively (find_library - # does not) and some versions of CTK nest nvml.dll several directories deep - # under C:\Windows\System32. - find_file(NVBench_NVML_DLL nvml.dll - DOC "The full path to nvml.dll. Usually somewhere under C:/Windows/System32." - PATHS "C:/Windows/System32" - ) - mark_as_advanced(NVBench_NVML_DLL) -endif() - -if (NVBench_NVML_DLL) - add_library(nvbench::nvml SHARED IMPORTED) - target_link_libraries(nvbench::nvml INTERFACE CUDA::toolkit) - set_target_properties(nvbench::nvml PROPERTIES - IMPORTED_LOCATION "${NVBench_NVML_DLL}" - IMPORTED_IMPLIB "${CUDA_nvml_LIBRARY}" - ) -elseif(TARGET CUDA::nvml) - add_library(nvbench::nvml ALIAS CUDA::nvml) -else() - message(FATAL_ERROR "Could not find nvml.dll or CUDA::nvml target. " - "Set -DNVBench_ENABLE_NVML=OFF to disable NVML support " - "or set -DNVBench_NVML_DLL to the full path to nvml.dll on Windows.") -endif() +add_library(nvbench::nvml ALIAS CUDA::nvml) diff --git a/cmake/header_test.in.cxx b/cmake/header_test.in.cxx index c26753e..8772c83 100644 --- a/cmake/header_test.in.cxx +++ b/cmake/header_test.in.cxx @@ -16,26 +16,14 @@ // Use raw platform checks instead of the NVBench_HOST_COMPILER macros since we // don't want to #include any headers other than the one being tested. // -// This is only implemented for MSVC/GCC/Clang. -#if defined(_MSC_VER) // MSVC - -// Fake up an error for MSVC -#define NVBench_MACRO_CHECK_IMPL(msg) \ - /* Print message that looks like an error: */ \ - __pragma(message(__FILE__ ":" NVBench_MACRO_CHECK_IMPL0(__LINE__) \ - ": error: " #msg)) \ - /* abort compilation due to static_assert or syntax error: */ \ - static_assert(false, #msg); -#define NVBench_MACRO_CHECK_IMPL0(x) NVBench_MACRO_CHECK_IMPL1(x) -#define NVBench_MACRO_CHECK_IMPL1(x) #x - -#elif defined(__clang__) || defined(__GNUC__) +// This is only implemented for GCC/Clang. +#if defined(__clang__) || defined(__GNUC__) // GCC/clang are easy: #define NVBench_MACRO_CHECK_IMPL(msg) NVBench_MACRO_CHECK_IMPL0(GCC error #msg) #define NVBench_MACRO_CHECK_IMPL0(expr) _Pragma(#expr) -#endif +#endif // defined(__clang__) || defined(__GNUC__) // complex.h conflicts #define I NVBench_MACRO_CHECK('I', complex.h) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a98bcbe..dc6e52b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -39,30 +39,6 @@ function (nvbench_add_examples_target target_prefix cuda_std) add_dependencies(${target_prefix}.all ${example_name}) endforeach() - - # Silence some warnings from old thrust headers: - set(thrust_examples - auto_throughput - axes - custom_criterion - exec_tag_sync - exec_tag_timer - skip - stream - throughput - ) - foreach (example IN LISTS thrust_examples) - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # C4324: structure was padded due to alignment specifier - nvbench_add_cxx_flag(${target_prefix}.${example} PRIVATE "/wd4324") - - # warning C4201: nonstandard extension used: nameless struct/union: - # Fixed in Thrust 1.12.0 (CTK 11.4, NV HPC 21.3) - if (${CUDAToolkit_VERSION} VERSION_LESS 11.4) - nvbench_add_cxx_flag(${target_prefix}.${example} PRIVATE "/wd4201") - endif() - endif() - endforeach() endfunction() diff --git a/exec/CMakeLists.txt b/exec/CMakeLists.txt index a6a3eb5..775dccc 100644 --- a/exec/CMakeLists.txt +++ b/exec/CMakeLists.txt @@ -6,7 +6,6 @@ set_target_properties(nvbench.ctl PROPERTIES EXPORT_NAME ctl ) add_dependencies(nvbench.all nvbench.ctl) -nvbench_setup_dep_dlls(nvbench.ctl) nvbench_install_executables(nvbench.ctl) if (NVBench_ENABLE_TESTING) diff --git a/nvbench/CMakeLists.txt b/nvbench/CMakeLists.txt index 182843c..265fa99 100644 --- a/nvbench/CMakeLists.txt +++ b/nvbench/CMakeLists.txt @@ -117,7 +117,6 @@ add_dependencies(nvbench.all nvbench.main) add_library(nvbench::nvbench ALIAS nvbench) add_library(nvbench::main ALIAS nvbench.main) -nvbench_setup_dep_dlls(nvbench) nvbench_install_libraries(nvbench nvbench.main nvbench.build_interface) # nvcc emits several unavoidable warnings while compiling nlohmann_json: diff --git a/nvbench/config.cuh.in b/nvbench/config.cuh.in index 3ac45fb..68eba6f 100644 --- a/nvbench/config.cuh.in +++ b/nvbench/config.cuh.in @@ -24,21 +24,7 @@ // Defined if NVBench has been built with CUPTI support. #cmakedefine NVBENCH_HAS_CUPTI -#ifdef _MSC_VER -#define NVBENCH_MSVC_PUSH_DISABLE_WARNING(code) \ - __pragma(warning(push)) __pragma(warning(disable : code)) -#define NVBENCH_MSVC_POP_WARNING() __pragma(warning(pop)) -#else -#define NVBENCH_MSVC_PUSH_DISABLE_WARNING(code) -#define NVBENCH_MSVC_POP_WARNING() -#endif - -// MSVC does not define __cplusplus correctly. _MSVC_LANG is used instead. -#ifdef _MSVC_LANG -#define NVBENCH_CPLUSPLUS _MSVC_LANG -#else #define NVBENCH_CPLUSPLUS __cplusplus -#endif // Detect current dialect: #if NVBENCH_CPLUSPLUS < 201703L diff --git a/nvbench/csv_printer.cu b/nvbench/csv_printer.cu index a0a906e..a0db080 100644 --- a/nvbench/csv_printer.cu +++ b/nvbench/csv_printer.cu @@ -45,12 +45,9 @@ void csv_printer::do_print_benchmark_results(const benchmark_vector &benches) return v; } - // warning C4702: unreachable code // This is a future-proofing fallback that's currently unused. - NVBENCH_MSVC_PUSH_DISABLE_WARNING(4702) return fmt::format("{}", v); }; - NVBENCH_MSVC_POP_WARNING() // Prepare table: nvbench::internal::table_builder table; diff --git a/nvbench/detail/state_exec.cuh b/nvbench/detail/state_exec.cuh index bab2daf..b87f487 100644 --- a/nvbench/detail/state_exec.cuh +++ b/nvbench/detail/state_exec.cuh @@ -39,11 +39,6 @@ namespace nvbench { -// warning C4702: unreachable code -// Several spurious instances in this function. MSVC 2019 seems to forget that -// sometimes the constexpr branch /isn't/ taken. -NVBENCH_MSVC_PUSH_DISABLE_WARNING(4702) - template void state::exec(ExecTags tags, KernelLauncher &&kernel_launcher) { @@ -150,6 +145,4 @@ void state::exec(ExecTags tags, KernelLauncher &&kernel_launcher) } } -NVBENCH_MSVC_POP_WARNING() - } // namespace nvbench diff --git a/nvbench/markdown_printer.cu b/nvbench/markdown_printer.cu index 6b892a8..a1e8b1d 100644 --- a/nvbench/markdown_printer.cu +++ b/nvbench/markdown_printer.cu @@ -213,12 +213,9 @@ void markdown_printer::do_print_benchmark_results(const printer_base::benchmark_ return v; } - // warning C4702: unreachable code // This is a future-proofing fallback that's currently unused. - NVBENCH_MSVC_PUSH_DISABLE_WARNING(4702) return fmt::format("{}", v); }; - NVBENCH_MSVC_POP_WARNING() // Start printing benchmarks fmt::memory_buffer buffer; @@ -342,12 +339,9 @@ std::string markdown_printer::do_format_default(const summary &data) return v; } - // warning C4702: unreachable code // This is a future-proofing fallback that's currently unused. - NVBENCH_MSVC_PUSH_DISABLE_WARNING(4702) return fmt::format("{}", v); }; - NVBENCH_MSVC_POP_WARNING() return std::visit(format_visitor, data.get_value("value")); } diff --git a/nvbench/named_values.cxx b/nvbench/named_values.cxx index 605789e..e672301 100644 --- a/nvbench/named_values.cxx +++ b/nvbench/named_values.cxx @@ -88,13 +88,10 @@ named_values::type named_values::get_type(const std::string &name) const { return nvbench::named_values::type::string; } - // warning C4702: unreachable code // This is a future-proofing check, it'll be reachable if something breaks - NVBENCH_MSVC_PUSH_DISABLE_WARNING(4702) NVBENCH_THROW(std::runtime_error, "Unknown variant type for entry '{}'.", name); }, this->get_value(name)); - NVBENCH_MSVC_POP_WARNING() } nvbench::int64_t named_values::get_int64(const std::string &name) const diff --git a/testing/cmake/CMakeLists.txt b/testing/cmake/CMakeLists.txt index 6932c00..c4e4eb7 100644 --- a/testing/cmake/CMakeLists.txt +++ b/testing/cmake/CMakeLists.txt @@ -1,9 +1,3 @@ -if ("MSVC" STREQUAL "${CMAKE_CXX_COMPILER_ID}") - # There's a bug that prevents build-and-test from working on MSVC. - # See NVIDIA/nvbench#43. - return() -endif() - # Need to escape the semicolons in CUDA_ARCHITECTURES or the tests break: nvbench_escaped_cuda_arches(arches)