Skip to content

Commit 4bd22ea

Browse files
committed
2 parents 9549a19 + f8778c1 commit 4bd22ea

13 files changed

Lines changed: 2032 additions & 0 deletions

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "posts/parallel_reduction_with_shfl/cub"]
22
path = posts/parallel_reduction_with_shfl/cub
33
url = https://github.com/NVLabs/cub.git
4+
[submodule "posts/american-options/external/cub"]
5+
path = posts/american-options/external/cub
6+
url = git://github.com/NVlabs/cub.git
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LongstaffSchwartzSvd2_vs10", "VisualStudio\LongstaffSchwartzSvd2_vs10.vcxproj", "{06CCAF3C-E0E2-43E7-8C4C-EC593F181077}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|x64 = Debug|x64
9+
Release|x64 = Release|x64
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{06CCAF3C-E0E2-43E7-8C4C-EC593F181077}.Debug|x64.ActiveCfg = Debug|x64
13+
{06CCAF3C-E0E2-43E7-8C4C-EC593F181077}.Debug|x64.Build.0 = Debug|x64
14+
{06CCAF3C-E0E2-43E7-8C4C-EC593F181077}.Release|x64.ActiveCfg = Release|x64
15+
{06CCAF3C-E0E2-43E7-8C4C-EC593F181077}.Release|x64.Build.0 = Release|x64
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LongstaffSchwartzSvd2_vs11", "VisualStudio\LongstaffSchwartzSvd2_vs11.vcxproj", "{FD28157D-774D-4499-87F0-B49183DBE1F1}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|x64 = Debug|x64
9+
Release|x64 = Release|x64
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{FD28157D-774D-4499-87F0-B49183DBE1F1}.Debug|x64.ActiveCfg = Debug|x64
13+
{FD28157D-774D-4499-87F0-B49183DBE1F1}.Debug|x64.Build.0 = Debug|x64
14+
{FD28157D-774D-4499-87F0-B49183DBE1F1}.Release|x64.ActiveCfg = Release|x64
15+
{FD28157D-774D-4499-87F0-B49183DBE1F1}.Release|x64.Build.0 = Release|x64
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

posts/american-options/Makefile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
###################################################################################################
2+
#
3+
# Paths to modify
4+
#
5+
###################################################################################################
6+
7+
# The CUDA path
8+
9+
CUDA_PATH ?= /usr/local/cuda-5.5
10+
11+
CUDA_INC_PATH ?= $(CUDA_PATH)/include
12+
CUDA_LIB_PATH ?= $(CUDA_PATH)/lib64
13+
14+
# The CUB library.
15+
16+
CUB_INC_PATH ?= external/cub
17+
18+
###################################################################################################
19+
#
20+
# Compiler options
21+
#
22+
###################################################################################################
23+
24+
CXX_COMMON_FLAGS = -O3 -I$(CUB_INC_PATH)
25+
26+
# C++ compiler
27+
28+
CXX = g++
29+
CXX_FLAGS = $(CXX_COMMON_FLAGS) -Wall -I$(CUDA_INC_PATH)
30+
31+
# Gencodes.
32+
33+
COMMA = ,
34+
SPACE :=
35+
SPACE +=
36+
37+
ifdef ($(SM_ARCH))
38+
NVCC_GENCODES = $(foreach ARCH, $(subst $(COMMA), $(SPACE), $(SM_ARCH)), -gencode=arch=compute_$(ARCH),code=sm_$(ARCH))
39+
else
40+
NVCC_GENCODES += -gencode=arch=compute_20,code=sm_20
41+
NVCC_GENCODES += -gencode=arch=compute_35,code=sm_35
42+
endif
43+
44+
# CUDA compiler
45+
46+
NVCC = $(CUDA_PATH)/bin/nvcc
47+
NVCC_FLAGS = $(CXX_COMMON_FLAGS) -m64 $(NVCC_GENCODES)
48+
49+
# The flags/library for the Longstaff-Schwartz code.
50+
51+
LONGSTAFF_SCHWARTZ_FLAGS = $(NVCC_FLAGS) -DWITH_FUSED_BETA
52+
LONGSTAFF_SCHWARTZ_LIBS = -lcurand
53+
54+
ifeq ($(WITH_CPU_REFERENCE), 1)
55+
LONGSTAFF_SCHWARTZ_FLAGS += -DWITH_CPU_REFERENCE
56+
LONGSTAFF_SCHWARTZ_LIBS += -llapack
57+
endif
58+
59+
ifeq ($(WITH_FULL_W_MATRIX), 1)
60+
LONGSTAFF_SCHWARTZ_FLAGS += -DWITH_FULL_W_MATRIX
61+
endif
62+
63+
###################################################################################################
64+
65+
BINARIES = bin/longstaff_schwartz_svd_2
66+
67+
###################################################################################################
68+
#
69+
# The rules to build the code
70+
#
71+
###################################################################################################
72+
all:
73+
$(MAKE) dirs
74+
$(MAKE) $(BINARIES)
75+
76+
dirs:
77+
if [ ! -d bin ] ; then mkdir bin ; fi
78+
79+
bin/longstaff_schwartz_svd_2: longstaff_schwartz_svd_2.cu
80+
$(NVCC) $(LONGSTAFF_SCHWARTZ_FLAGS) -o $@ $< $(LONGSTAFF_SCHWARTZ_LIBS)
81+
82+
clean:
83+
rm -rf bin
84+

posts/american-options/Readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
To build you will need to download CUB.
2+
3+
To do this run the following command from the code-samples directory:
4+
5+
%> git submodule update --init --recursive
6+
7+
You can either build with Visual Studio (we provide solutions for VS2010 and VS2012) on Windows or make on Linux.
8+
9+
You need CUDA 5.5 to build with Visual Studio.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.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+
<PropertyGroup Label="Globals">
14+
<ProjectGuid>{06CCAF3C-E0E2-43E7-8C4C-EC593F181077}</ProjectGuid>
15+
<Keyword>Win32Proj</Keyword>
16+
<RootNamespace>LongstaffSchwartzSvd2</RootNamespace>
17+
</PropertyGroup>
18+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
20+
<ConfigurationType>Application</ConfigurationType>
21+
<UseDebugLibraries>true</UseDebugLibraries>
22+
<CharacterSet>Unicode</CharacterSet>
23+
</PropertyGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
25+
<ConfigurationType>Application</ConfigurationType>
26+
<UseDebugLibraries>false</UseDebugLibraries>
27+
<WholeProgramOptimization>true</WholeProgramOptimization>
28+
<CharacterSet>Unicode</CharacterSet>
29+
</PropertyGroup>
30+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31+
<ImportGroup Label="ExtensionSettings">
32+
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.props" />
33+
</ImportGroup>
34+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
35+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
36+
</ImportGroup>
37+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
38+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
39+
</ImportGroup>
40+
<PropertyGroup Label="UserMacros" />
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
42+
<LinkIncremental>true</LinkIncremental>
43+
</PropertyGroup>
44+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
45+
<LinkIncremental>false</LinkIncremental>
46+
</PropertyGroup>
47+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
48+
<ClCompile>
49+
<PrecompiledHeader>
50+
</PrecompiledHeader>
51+
<WarningLevel>Level3</WarningLevel>
52+
<Optimization>Disabled</Optimization>
53+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
54+
</ClCompile>
55+
<Link>
56+
<SubSystem>Console</SubSystem>
57+
<GenerateDebugInformation>true</GenerateDebugInformation>
58+
<AdditionalDependencies>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);cudart.lib;curand.lib</AdditionalDependencies>
59+
</Link>
60+
<CudaCompile>
61+
<TargetMachinePlatform>64</TargetMachinePlatform>
62+
<CodeGeneration>compute_20,sm_20;compute_35,sm_35</CodeGeneration>
63+
<Include>$(SolutionDir)\external\cub</Include>
64+
<Defines>WITH_FUSED_BETA</Defines>
65+
</CudaCompile>
66+
</ItemDefinitionGroup>
67+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
68+
<ClCompile>
69+
<WarningLevel>Level3</WarningLevel>
70+
<PrecompiledHeader>
71+
</PrecompiledHeader>
72+
<Optimization>MaxSpeed</Optimization>
73+
<FunctionLevelLinking>true</FunctionLevelLinking>
74+
<IntrinsicFunctions>true</IntrinsicFunctions>
75+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
76+
</ClCompile>
77+
<Link>
78+
<SubSystem>Console</SubSystem>
79+
<GenerateDebugInformation>true</GenerateDebugInformation>
80+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
81+
<OptimizeReferences>true</OptimizeReferences>
82+
<AdditionalDependencies>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);cudart.lib;curand.lib</AdditionalDependencies>
83+
</Link>
84+
<CudaCompile>
85+
<TargetMachinePlatform>64</TargetMachinePlatform>
86+
<CodeGeneration>compute_20,sm_20;compute_35,sm_35</CodeGeneration>
87+
<Include>$(SolutionDir)\external\cub</Include>
88+
<Defines>WITH_FUSED_BETA</Defines>
89+
</CudaCompile>
90+
</ItemDefinitionGroup>
91+
<ItemGroup>
92+
<CudaCompile Include="..\longstaff_schwartz_svd_2.cu" />
93+
</ItemGroup>
94+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
95+
<ImportGroup Label="ExtensionTargets">
96+
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.targets" />
97+
</ImportGroup>
98+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<CudaCompile Include="..\longstaff_schwartz_svd_2.cu">
11+
<Filter>Source Files</Filter>
12+
</CudaCompile>
13+
</ItemGroup>
14+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
</Project>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.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+
<PropertyGroup Label="Globals">
14+
<ProjectGuid>{FD28157D-774D-4499-87F0-B49183DBE1F1}</ProjectGuid>
15+
<Keyword>Win32Proj</Keyword>
16+
<RootNamespace>LongstaffSchwartzSvd2</RootNamespace>
17+
</PropertyGroup>
18+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
20+
<ConfigurationType>Application</ConfigurationType>
21+
<UseDebugLibraries>true</UseDebugLibraries>
22+
<CharacterSet>Unicode</CharacterSet>
23+
<PlatformToolset>v110</PlatformToolset>
24+
</PropertyGroup>
25+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
26+
<ConfigurationType>Application</ConfigurationType>
27+
<UseDebugLibraries>false</UseDebugLibraries>
28+
<WholeProgramOptimization>true</WholeProgramOptimization>
29+
<CharacterSet>Unicode</CharacterSet>
30+
<PlatformToolset>v110</PlatformToolset>
31+
</PropertyGroup>
32+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
33+
<ImportGroup Label="ExtensionSettings">
34+
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.props" />
35+
</ImportGroup>
36+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
37+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38+
</ImportGroup>
39+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
40+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
41+
</ImportGroup>
42+
<PropertyGroup Label="UserMacros" />
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
44+
<LinkIncremental>true</LinkIncremental>
45+
</PropertyGroup>
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
47+
<LinkIncremental>false</LinkIncremental>
48+
</PropertyGroup>
49+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
50+
<ClCompile>
51+
<PrecompiledHeader>
52+
</PrecompiledHeader>
53+
<WarningLevel>Level3</WarningLevel>
54+
<Optimization>Disabled</Optimization>
55+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
56+
</ClCompile>
57+
<Link>
58+
<SubSystem>Console</SubSystem>
59+
<GenerateDebugInformation>true</GenerateDebugInformation>
60+
<AdditionalDependencies>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);cudart.lib;curand.lib</AdditionalDependencies>
61+
</Link>
62+
<CudaCompile>
63+
<TargetMachinePlatform>64</TargetMachinePlatform>
64+
<CodeGeneration>compute_20,sm_20;compute_35,sm_35</CodeGeneration>
65+
<Include>$(SolutionDir)\external\cub</Include>
66+
<Defines>WITH_FUSED_BETA</Defines>
67+
</CudaCompile>
68+
</ItemDefinitionGroup>
69+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<ClCompile>
71+
<WarningLevel>Level3</WarningLevel>
72+
<PrecompiledHeader>
73+
</PrecompiledHeader>
74+
<Optimization>MaxSpeed</Optimization>
75+
<FunctionLevelLinking>true</FunctionLevelLinking>
76+
<IntrinsicFunctions>true</IntrinsicFunctions>
77+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
78+
</ClCompile>
79+
<Link>
80+
<SubSystem>Console</SubSystem>
81+
<GenerateDebugInformation>true</GenerateDebugInformation>
82+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
83+
<OptimizeReferences>true</OptimizeReferences>
84+
<AdditionalDependencies>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);cudart.lib;curand.lib</AdditionalDependencies>
85+
</Link>
86+
<CudaCompile>
87+
<TargetMachinePlatform>64</TargetMachinePlatform>
88+
<CodeGeneration>compute_20,sm_20;compute_35,sm_35</CodeGeneration>
89+
<Include>$(SolutionDir)\external\cub</Include>
90+
<Defines>WITH_FUSED_BETA</Defines>
91+
</CudaCompile>
92+
</ItemDefinitionGroup>
93+
<ItemGroup>
94+
<CudaCompile Include="..\longstaff_schwartz_svd_2.cu" />
95+
</ItemGroup>
96+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
97+
<ImportGroup Label="ExtensionTargets">
98+
<Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.targets" />
99+
</ImportGroup>
100+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<CudaCompile Include="..\longstaff_schwartz_svd_2.cu">
11+
<Filter>Source Files</Filter>
12+
</CudaCompile>
13+
</ItemGroup>
14+
</Project>

0 commit comments

Comments
 (0)