mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2025-08-23 15:10:31 +08:00
Merge branch 'dev/mattd/r13-nvvm-update-master' into 'master'
Update compute capability checks to test for >=sm75. See merge request cuda-samples/cuda-samples!126
This commit is contained in:
commit
2ab16e6d15
@ -4,7 +4,9 @@ libNVVM and NVVM IR Samples
|
||||
Introduction
|
||||
------------
|
||||
|
||||
The following samples illustrate the use of libNVVM and NVVM IR.
|
||||
The following samples illustrate the use of libNVVM and NVVM IR. Running and
|
||||
testing these samples requires an NVIDIA driver compatible with the CUDA
|
||||
Toolkit being used for compilation.
|
||||
|
||||
- cuda-shared-memory - A directory containing NVVM IR programs that demonstrate
|
||||
CUDA 'shared' memory usage.
|
||||
@ -71,7 +73,7 @@ A Note About the cuda-c-linking Sample
|
||||
|
||||
This sample requires a development package (or locally-built) LLVM library
|
||||
between versions 7 to 14 inclusive. LLVM 15 defaults to using opaque pointers,
|
||||
which are currently not supported in libNVVM.
|
||||
which are not supported in libNVVM for pre-Blackwell architectures.
|
||||
|
||||
The LLVM_HOME environment variable is required for users who wish to build the
|
||||
cuda-c-linking sample and have a locally built copy of LLVM that they wish to
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 1993-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
# Copyright (c) 1993-2025, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@ -29,7 +29,7 @@ if (LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL "15" OR
|
||||
LLVM_PACKAGE_VERSION VERSION_LESS "7")
|
||||
message(STATUS "The cuda-c-linking sample is expected to build with "
|
||||
"LLVM development libraries v7 to v14, opaque pointers are "
|
||||
"not yet supported in libNVVM.")
|
||||
"not supported in libNVVM for pre-Blackwell architectures.")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 1993-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
// Copyright (c) 1993-2025, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
@ -216,8 +216,8 @@ int main(int argc, char **argv)
|
||||
checkCudaErrors(cuDeviceGetAttribute(&devMajor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device));
|
||||
checkCudaErrors(cuDeviceGetAttribute(&devMinor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device));
|
||||
outs() << "Device Compute Capability: " << devMajor << "." << devMinor << "\n";
|
||||
if (devMajor < 5) {
|
||||
errs() << "ERROR: Device 0 is not sm_50 or later.\n";
|
||||
if (devMajor < 7 && devMinor < 5) {
|
||||
errs() << "ERROR: Device 0 is not sm_75 or later.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
// Copyright (c) 2014-2025, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
@ -181,8 +181,8 @@ static CUdevice cudaDeviceInit(int *major, int *minor)
|
||||
checkCudaErrors(cuDeviceGetAttribute(major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice));
|
||||
checkCudaErrors(cuDeviceGetAttribute(minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice));
|
||||
printf("compute capability = %d.%d\n", *major, *minor);
|
||||
if (*major < 5) {
|
||||
fprintf(stderr, "Device 0 is not sm_50 or later\n");
|
||||
if (*major < 7 && *minor < 5) {
|
||||
fprintf(stderr, "Device 0 is not sm_75 or later\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return cuDevice;
|
||||
|
@ -22,6 +22,6 @@ interleaved.
|
||||
|
||||
For example,
|
||||
|
||||
$ ptxgen a.ll -arch=compute_50 b.bc
|
||||
$ ptxgen a.ll -arch=compute_75 b.bc
|
||||
|
||||
links a.ll and b.bc, and generates PTX code for the compute_50 architecture.
|
||||
links a.ll and b.bc, and generates PTX code for the compute_75 architecture.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 1993-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
// Copyright (c) 1993-2025, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
@ -74,8 +74,8 @@ static CUdevice cudaDeviceInit(int *devMajor, int *devMinor)
|
||||
|
||||
// Obtain the device's compute capability.
|
||||
checkCudaErrors(cuDeviceGetAttribute(devMajor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice));
|
||||
if (*devMajor < 5) {
|
||||
fprintf(stderr, "Device 0 is not sm_50 or later\n");
|
||||
if (*devMajor < 7 && *devMinor < 5) {
|
||||
fprintf(stderr, "Device 0 is not sm_75 or later\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
checkCudaErrors(cuDeviceGetAttribute(devMinor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice));
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
// Copyright (c) 2014-2025, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
@ -172,8 +172,8 @@ static CUdevice cudaDeviceInit(int *major, int *minor)
|
||||
checkCudaErrors(cuDeviceGetAttribute(major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuDevice));
|
||||
checkCudaErrors(cuDeviceGetAttribute(minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuDevice));
|
||||
printf("compute capability = %d.%d\n", *major, *minor);
|
||||
if (*major < 5) {
|
||||
fprintf(stderr, "Device 0 is not sm_50 or later\n");
|
||||
if (*major < 7 && *minor < 5) {
|
||||
fprintf(stderr, "Device 0 is not sm_75 or later\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user