Skip to content

Fix CMake configure error on Windows in thrust benchmarks#9121

Open
miyanyan wants to merge 1 commit into
NVIDIA:mainfrom
miyanyan:fix-windows-cmake
Open

Fix CMake configure error on Windows in thrust benchmarks#9121
miyanyan wants to merge 1 commit into
NVIDIA:mainfrom
miyanyan:fix-windows-cmake

Conversation

@miyanyan
Copy link
Copy Markdown
Contributor

Description

I used vs2026 to configure cccl with all-dev preset and found these errors:

1> [CMake] CMake Error: Could not open file for write in copy operation D:/github/miyanyan/cccl/build/all-dev/thrust/benchmarks/thrust.cpp.cpp/D:/github/miyanyan/cccl/thrust/benchmarks/bench/adjacent_difference/basic.cu.cpp.tmp
1> [CMake] CMake Error: : System Error: Invalid argument
1> [CMake] CMake Error at thrust/benchmarks/CMakeLists.txt:43 (configure_file):
1> [CMake]   configure_file Problem configuring file
1> [CMake] Call Stack (most recent call first):
1> [CMake]   thrust/benchmarks/CMakeLists.txt:65 (thrust_wrap_bench_in_cpp)
1> [CMake]   thrust/benchmarks/CMakeLists.txt:90 (add_bench_dir)
1> [CMake] CMake Error: Could not open file for write in copy operation D:/github/miyanyan/cccl/build/all-dev/thrust/benchmarks/thrust.cpp.omp/D:/github/miyanyan/cccl/thrust/benchmarks/bench/adjacent_difference/basic.cu.cpp.tmp
1> [CMake] CMake Error: : System Error: Invalid argument
1> [CMake] CMake Error at thrust/benchmarks/CMakeLists.txt:43 (configure_file):
1> [CMake]   configure_file Problem configuring file
1> [CMake] Call Stack (most recent call first):
1> [CMake]   thrust/benchmarks/CMakeLists.txt:65 (thrust_wrap_bench_in_cpp)
1> [CMake]   thrust/benchmarks/CMakeLists.txt:90 (add_bench_dir)
1> [CMake] CMake Error: Could not open file for write in copy operation D:/github/miyanyan/cccl/build/all-dev/thrust/benchmarks/thrust.cpp.tbb/D:/github/miyanyan/cccl/thrust/benchmarks/bench/adjacent_difference/basic.cu.cpp.tmp
1> [CMake] CMake Error: : System Error: Invalid argument
1> [CMake] CMake Error at thrust/benchmarks/CMakeLists.txt:43 (configure_file):
1> [CMake]   configure_file Problem configuring file
1> [CMake] Call Stack (most recent call first):
1> [CMake]   thrust/benchmarks/CMakeLists.txt:65 (thrust_wrap_bench_in_cpp)
1> [CMake]   thrust/benchmarks/CMakeLists.txt:90 (add_bench_dir)
1> [CMake] CMake Error: Could not open file for write in copy operation D:/github/miyanyan/cccl/build/all-dev/thrust/benchmarks/thrust.omp.omp/D:/github/miyanyan/cccl/thrust/benchmarks/bench/adjacent_difference/basic.cu.cpp.tmp
1> [CMake] CMake Error: : System Error: Invalid argument

Non-CUDA benchmark targets wrap .cu files into generated .cpp files. The wrapper output path was built from an absolute benchmark source path, which produces an invalid build-tree path on Windows because it embeds the drive prefix.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

`thrust_wrap_bench_in_cpp` was constructing the `configure_file` output path
by appending the full absolute source path to `${CMAKE_CURRENT_BINARY_DIR}`.
On Windows this produced an invalid path containing two drive letters (e.g.
`build/.../D:/source/.../file.cu.cpp`), causing CMake to fail with "System
Error: Invalid argument".
@miyanyan miyanyan requested a review from a team as a code owner May 24, 2026 05:44
@miyanyan miyanyan requested a review from oleksandr-pavlyk May 24, 2026 05:44
@github-project-automation github-project-automation Bot moved this to Todo in CCCL May 24, 2026
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot Bot commented May 24, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL May 24, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3f8e39b6-bf95-442c-8e48-2f821675fffd

📥 Commits

Reviewing files that changed from the base of the PR and between c47f140 and 626b385.

📒 Files selected for processing (2)
  • .gitignore
  • thrust/benchmarks/CMakeLists.txt

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved build system output consistency by refining file naming conventions for generated outputs.
    • Updated development environment configuration settings.

Walkthrough

Two independent configuration updates: Visual Studio artifacts excluded from version control, and benchmark wrapping CMake function refactored to use relative paths instead of absolute paths when naming generated wrapped .cpp files from .cu sources.

Changes

Build Configuration Updates

Layer / File(s) Summary
IDE artifacts exclusion
.gitignore
.vs/ directory added to gitignore to exclude Visual Studio build artifacts.
CMake relative path computation
thrust/benchmarks/CMakeLists.txt
thrust_wrap_bench_in_cpp function now derives relative cu-file path from CMAKE_CURRENT_LIST_DIR and uses it for generated cpp_file naming, replacing absolute path embedding with repo-relative layout convention.

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant