Skip to content

Commit c94990a

Browse files
author
Sam
committed
Update CUDA 13.1.1 for samples
1 parent 8e3da12 commit c94990a

2 files changed

Lines changed: 42 additions & 13 deletions

File tree

src/Makefile

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ else
1212
all: pannotia rodinia_2.0-ft proxy-apps microbench rodinia-3.1 ispass-2009 polybench parboil shoc custom_apps
1313
endif
1414
endif
15-
ifneq ($(filter 13 14 15 16,$(CUDA_VERSION_MAJOR)),)
16-
ci: rodinia_2.0-ft rodinia-3.1 GPU_Microbenchmark cutlass_mini
17-
else
1815
ci: rodinia_2.0-ft rodinia-3.1 GPU_Microbenchmark cutlass_mini cuda_samples
19-
endif
16+
# Keep the repository pinned to the legacy cuda-samples revision for older toolkits,
17+
# but use the upstream CUDA 13.1 samples when building with CUDA 13.
18+
CUDA_SAMPLES_CUDA13_REF := 4f735616ba599fe93cc2c6c85dcb4369260f9643
19+
CUDA_SAMPLES_PINNED_REF := $(shell git -C .. rev-parse HEAD:src/cuda/cuda-samples 2>/dev/null)
2020
accelwattch: accelwattch_validation accelwattch_hw_power accelwattch_ubench
2121
accelwattch_validation: rodinia-3.1_accelwattch_validation parboil_accelwattch_validation cutlass cuda_samples-11.0_accelwattch_validation
2222
accelwattch_hw_power: rodinia-3.1_hw_power parboil_hw_power cuda_samples-11.0_hw_power
@@ -522,13 +522,40 @@ mlperf_training:
522522

523523
cuda_samples:
524524
mkdir -p $(BINDIR)/$(BINSUBDIR)/
525+
set -eu; \
526+
repo_dir=./cuda/cuda-samples; \
527+
desired_ref="$(CUDA_SAMPLES_PINNED_REF)"; \
528+
if [ -z "$$desired_ref" ]; then \
529+
desired_ref=$$(git -C "$$repo_dir" rev-parse HEAD); \
530+
fi; \
531+
source_dir="$$repo_dir"; \
532+
build_dir="$$repo_dir/build-$(CUDA_VERSION)"; \
533+
export_dir=; \
534+
cleanup_cuda_samples() { \
535+
if [ -n "$$export_dir" ] && [ -d "$$export_dir" ]; then \
536+
rm -rf "$$export_dir"; \
537+
fi; \
538+
}; \
539+
trap 'cleanup_cuda_samples' EXIT; \
525540
if [ ${CUDA_VERSION_MAJOR} -ge 13 ]; then \
526-
cmake -S ./cuda/cuda-samples -B ./cuda/cuda-samples/build -DCMAKE_CUDA_ARCHITECTURES="75;80;86;89;90"; \
527-
else \
528-
cmake -S ./cuda/cuda-samples -B ./cuda/cuda-samples/build; \
529-
fi
530-
$(MAKE) -C ./cuda/cuda-samples/build
531-
find $(GPUAPPS_ROOT)/src/cuda/cuda-samples/build/Samples -type f -executable -exec mv {} "$(BINDIR)/$(BINSUBDIR)/" \; ;
541+
desired_ref="$(CUDA_SAMPLES_CUDA13_REF)"; \
542+
fi; \
543+
original_ref=$$(git -C "$$repo_dir" rev-parse HEAD); \
544+
if [ "$$original_ref" != "$$desired_ref" ]; then \
545+
export_dir=./cuda/cuda-samples-export-$(CUDA_VERSION); \
546+
build_dir="$$repo_dir/build-$(CUDA_VERSION)-compat"; \
547+
git -C "$$repo_dir" rev-parse --verify "$$desired_ref^{commit}" >/dev/null; \
548+
rm -rf "$$export_dir"; \
549+
mkdir -p "$$export_dir"; \
550+
archive_file="$$export_dir/source.tar"; \
551+
git -C "$$repo_dir" archive --format=tar "$$desired_ref" > "$$archive_file"; \
552+
tar -xf "$$archive_file" -C "$$export_dir"; \
553+
rm -f "$$archive_file"; \
554+
source_dir="$$export_dir"; \
555+
fi; \
556+
cmake -S "$$source_dir" -B "$$build_dir"; \
557+
cmake --build "$$build_dir"; \
558+
find "$$build_dir"/Samples -type f -executable -exec mv {} "$(BINDIR)/$(BINSUBDIR)/" \; ;
532559

533560
pytorch_examples:
534561
mkdir -p $(BINDIR)/$(BINSUBDIR)/
@@ -720,7 +747,8 @@ clean_pytorch_examples:
720747
rm -f $(BINDIR)/$(BINSUBDIR)/inference_vae
721748

722749
clean_cuda_samples:
723-
$(MAKE) clean -C ./cuda/cuda-samples/build
750+
find ./cuda/cuda-samples -maxdepth 1 -type d \( -name 'build' -o -name 'build-*' \) -exec rm -rf {} +
751+
find ./cuda -maxdepth 1 -type d -name 'cuda-samples-export-*' -exec rm -rf {} +
724752

725753
clean_huggingface:
726754
rm -rf $(BINDIR)/$(BINSUBDIR)/huggingface

src/cuda/GPU_Microbenchmark/ubench/tma/mbarrier/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ SRC = mbarrier.cu
33
EXE = mbarrier
44

55
ifneq ($(filter 13 14 15 16,$(CUDA_VERSION_MAJOR)),)
6-
ARCH?=sm_80 sm_90a sm_100a sm_110 sm_120
6+
ARCH_DEFAULT := sm_80 sm_90a sm_100a sm_110 sm_120
77
else
8-
ARCH?=sm_80 sm_90a sm_100a sm_101 sm_120
8+
ARCH_DEFAULT := sm_80 sm_90a sm_100a sm_101 sm_120
99
endif
10+
ARCH ?= $(ARCH_DEFAULT)
1011
# Unset the CUDA_CPPFLAGS which is set based on CUDA version
1112
CUDA_CPPFLAGS=
1213

0 commit comments

Comments
 (0)