Skip to content

Commit d676178

Browse files
committed
add 12-14
1 parent 32c0ca7 commit d676178

File tree

5 files changed

+125
-0
lines changed

5 files changed

+125
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "KernelCall.h"
2+
3+
__global__ void kernel(void)
4+
{
5+
printf("Device code running on the GPU\n");
6+
}
7+
8+
void kernelCall(void)
9+
{
10+
kernel <<<1, 10>>> ();
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
#include "cuda_runtime.h"
3+
#include "device_launch_parameters.h"
4+
#include <stdio.h>
5+
6+
void kernelCall(void);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "kernelCall.h"
2+
3+
void main() {
4+
kernelCall();
5+
printf("Host code running on CPU\n");
6+
cudaDeviceSynchronize();
7+
}

CUDA_Programming.sln

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "12_11_CUDA_Event", "VS2019\
161161
EndProject
162162
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "12_12_MultiGPU", "VS2019\Book_BJ\Chap12\12_12_MultiGPU\12_12_MultiGPU.vcxproj", "{D75F1B6F-B6CD-4C5F-8188-E910184753F0}"
163163
EndProject
164+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "12_14_HetergeneousComputing", "VS2019\Book_BJ\Chap12\12_14_HetergeneousComputing\12_14_HetergeneousComputing.vcxproj", "{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}"
165+
EndProject
164166
Global
165167
GlobalSection(SolutionConfigurationPlatforms) = preSolution
166168
Debug|x64 = Debug|x64
@@ -487,6 +489,12 @@ Global
487489
{D75F1B6F-B6CD-4C5F-8188-E910184753F0}.Release|x64.ActiveCfg = Release|x64
488490
{D75F1B6F-B6CD-4C5F-8188-E910184753F0}.Release|x64.Build.0 = Release|x64
489491
{D75F1B6F-B6CD-4C5F-8188-E910184753F0}.Release|x86.ActiveCfg = Release|x64
492+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}.Debug|x64.ActiveCfg = Debug|x64
493+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}.Debug|x64.Build.0 = Debug|x64
494+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}.Debug|x86.ActiveCfg = Debug|x64
495+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}.Release|x64.ActiveCfg = Release|x64
496+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}.Release|x64.Build.0 = Release|x64
497+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}.Release|x86.ActiveCfg = Release|x64
490498
EndGlobalSection
491499
GlobalSection(SolutionProperties) = preSolution
492500
HideSolutionNode = FALSE
@@ -564,6 +572,7 @@ Global
564572
{19AA2AE1-5048-41DA-9902-BA49C1F01508} = {6F97EDD8-B0BD-4265-97A4-E783B011FA37}
565573
{F68B0724-486E-4D80-BA85-C89B2D8A4B25} = {6F97EDD8-B0BD-4265-97A4-E783B011FA37}
566574
{D75F1B6F-B6CD-4C5F-8188-E910184753F0} = {6F97EDD8-B0BD-4265-97A4-E783B011FA37}
575+
{B803E594-E9B4-4429-A9BD-6B417DBDB0A5} = {6F97EDD8-B0BD-4265-97A4-E783B011FA37}
567576
EndGlobalSection
568577
GlobalSection(ExtensibilityGlobals) = postSolution
569578
SolutionGuid = {52DE253B-6715-4A93-BA27-7131973681F9}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|x64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|x64">
9+
<Configuration>Release</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClInclude Include="..\..\..\..\Book_BJ\Chap12\12_14_HeterogeneousComputing\KernelCall.h" />
15+
</ItemGroup>
16+
<ItemGroup>
17+
<ClCompile Include="..\..\..\..\Book_BJ\Chap12\12_14_HeterogeneousComputing\main.cpp" />
18+
</ItemGroup>
19+
<ItemGroup>
20+
<CudaCompile Include="..\..\..\..\Book_BJ\Chap12\12_14_HeterogeneousComputing\DeviceCode.cu" />
21+
</ItemGroup>
22+
<PropertyGroup Label="Globals">
23+
<ProjectGuid>{B803E594-E9B4-4429-A9BD-6B417DBDB0A5}</ProjectGuid>
24+
<RootNamespace>_12_14_HetergeneousComputing</RootNamespace>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
28+
<ConfigurationType>Application</ConfigurationType>
29+
<UseDebugLibraries>true</UseDebugLibraries>
30+
<CharacterSet>MultiByte</CharacterSet>
31+
<PlatformToolset>v142</PlatformToolset>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
34+
<ConfigurationType>Application</ConfigurationType>
35+
<UseDebugLibraries>false</UseDebugLibraries>
36+
<WholeProgramOptimization>true</WholeProgramOptimization>
37+
<CharacterSet>MultiByte</CharacterSet>
38+
<PlatformToolset>v142</PlatformToolset>
39+
</PropertyGroup>
40+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
41+
<ImportGroup Label="ExtensionSettings">
42+
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 11.6.props" />
43+
</ImportGroup>
44+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
45+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
46+
</ImportGroup>
47+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
48+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
49+
</ImportGroup>
50+
<PropertyGroup Label="UserMacros" />
51+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
52+
<LinkIncremental>true</LinkIncremental>
53+
</PropertyGroup>
54+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
55+
<ClCompile>
56+
<WarningLevel>Level3</WarningLevel>
57+
<Optimization>Disabled</Optimization>
58+
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
59+
</ClCompile>
60+
<Link>
61+
<GenerateDebugInformation>true</GenerateDebugInformation>
62+
<SubSystem>Console</SubSystem>
63+
<AdditionalDependencies>cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
64+
</Link>
65+
<CudaCompile>
66+
<TargetMachinePlatform>64</TargetMachinePlatform>
67+
</CudaCompile>
68+
</ItemDefinitionGroup>
69+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<ClCompile>
71+
<WarningLevel>Level3</WarningLevel>
72+
<Optimization>MaxSpeed</Optimization>
73+
<FunctionLevelLinking>true</FunctionLevelLinking>
74+
<IntrinsicFunctions>true</IntrinsicFunctions>
75+
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
76+
</ClCompile>
77+
<Link>
78+
<GenerateDebugInformation>true</GenerateDebugInformation>
79+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
80+
<OptimizeReferences>true</OptimizeReferences>
81+
<SubSystem>Console</SubSystem>
82+
<AdditionalDependencies>cudart_static.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
83+
</Link>
84+
<CudaCompile>
85+
<TargetMachinePlatform>64</TargetMachinePlatform>
86+
</CudaCompile>
87+
</ItemDefinitionGroup>
88+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
89+
<ImportGroup Label="ExtensionTargets">
90+
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 11.6.targets" />
91+
</ImportGroup>
92+
</Project>

0 commit comments

Comments
 (0)