mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-23 21:28:17 +08:00
add and update samples with CUDA 11.3 support
This commit is contained in:
@@ -27,7 +27,7 @@ cudaMallocAsync, cudaFreeAsync, cudaMemPoolSetAccess, cudaDeviceGetDefaultMemPoo
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Download and install the [CUDA Toolkit 11.2](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
|
||||
Download and install the [CUDA Toolkit 11.3](https://developer.nvidia.com/cuda-downloads) for your corresponding platform.
|
||||
|
||||
## Build and Run
|
||||
|
||||
|
||||
@@ -122,24 +122,23 @@ std::pair<int, int> getP2PCapableGpuPair() {
|
||||
int deviceId = itr->second;
|
||||
checkCudaErrors(cudaSetDevice(deviceId));
|
||||
|
||||
std::for_each(
|
||||
itr, bestFit.second,
|
||||
[&deviceId, &bestFitDeviceIds](decltype(*itr) mapPair) {
|
||||
if (deviceId != mapPair.second) {
|
||||
int access = 0;
|
||||
checkCudaErrors(
|
||||
cudaDeviceCanAccessPeer(&access, deviceId, mapPair.second));
|
||||
printf("Device=%d %s Access Peer Device=%d\n", deviceId,
|
||||
access ? "CAN" : "CANNOT", mapPair.second);
|
||||
if (access && bestFitDeviceIds.size() < kNumGpusRequired) {
|
||||
bestFitDeviceIds.emplace(deviceId);
|
||||
bestFitDeviceIds.emplace(mapPair.second);
|
||||
} else {
|
||||
printf("Ignoring device %i (max devices exceeded)\n",
|
||||
mapPair.second);
|
||||
}
|
||||
}
|
||||
});
|
||||
std::for_each(itr, bestFit.second, [&deviceId, &bestFitDeviceIds,
|
||||
&kNumGpusRequired](
|
||||
decltype(*itr) mapPair) {
|
||||
if (deviceId != mapPair.second) {
|
||||
int access = 0;
|
||||
checkCudaErrors(
|
||||
cudaDeviceCanAccessPeer(&access, deviceId, mapPair.second));
|
||||
printf("Device=%d %s Access Peer Device=%d\n", deviceId,
|
||||
access ? "CAN" : "CANNOT", mapPair.second);
|
||||
if (access && bestFitDeviceIds.size() < kNumGpusRequired) {
|
||||
bestFitDeviceIds.emplace(deviceId);
|
||||
bestFitDeviceIds.emplace(mapPair.second);
|
||||
} else {
|
||||
printf("Ignoring device %i (max devices exceeded)\n", mapPair.second);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (bestFitDeviceIds.size() >= kNumGpusRequired) {
|
||||
printf("Selected p2p capable devices - ");
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.2.props" />
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.3.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||
@@ -108,6 +108,6 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.2.targets" />
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.3.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.2.props" />
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.3.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
|
||||
@@ -104,6 +104,6 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.2.targets" />
|
||||
<Import Project="$(CUDAPropsPath)\CUDA 11.3.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user