Skip to content

Commit b937ac3

Browse files
Jenn500jennifer.l.jiang
andauthored
moving vector-add to new repo. (#7)
* moving vector-add to new repo. Signed-off-by: jennifer.l.jiang <[email protected]> * updated sample.json according to the comment Co-authored-by: jennifer.l.jiang <[email protected]>
1 parent 60d7216 commit b937ac3

File tree

9 files changed

+373
-39
lines changed

9 files changed

+373
-39
lines changed

DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/Makefile.fpga

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CXXFLAGS = -O2 -g -std=c++17
44
SRC := src/vector-add-buffers.cpp
55
USM_SRC := src/vector-add-usm.cpp
66

7-
.PHONY: fpga_emu run_emu clean
7+
.PHONY: fpga_emu run_emu fpga_emu_usm run_emu_usm clean
88

99
fpga_emu: vector-add-buffers.fpga_emu
1010
fpga_emu_usm: vector-add-usm.fpga_emu_usm
@@ -18,43 +18,49 @@ report_usm: vector-add-usm_report.a_usm
1818
vector-add-buffers.fpga_emu: $(SRC)
1919
$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -DFPGA_EMULATOR=1
2020
vector-add-usm.fpga_emu_usm: $(USM_SRC)
21-
$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -DFPGA_EMULATOR=1
21+
@#$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -DFPGA_EMULATOR=1
22+
@echo USM is not supported for FPGAs, yet
2223

2324

2425
a.o: $(SRC)
2526
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
2627
a_usm.o: $(USM_SRC)
27-
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
28-
28+
@#$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
29+
@echo USM is not supported for FPGAs, yet
2930

3031
vector-add-buffers.fpga: a.o
3132
$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware
3233
vector-add-usm.fpga: a_usm.o
33-
$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware
34+
@#$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware
35+
@echo USM is not supported for FPGAs, yet
3436

3537
run_emu: vector-add-buffers.fpga_emu
3638
./vector-add-buffers.fpga_emu
3739
run_emu_usm: vector-add-usm.fpga_emu_usm
38-
./vector-add-usm.fpga_emu_usm
40+
@#./vector-add-usm.fpga_emu_usm
41+
@echo USM is not supported for FPGAs, yet
3942

4043

4144
run_hw: vector-add-buffers.fpga
4245
./vector-add-buffers.fpga
4346
run_hw_usm: vector-add-usm.fpga
44-
./vector-add-usm.fpga
45-
47+
@#./vector-add-usm.fpga
48+
@echo USM is not supported for FPGAs, yet
4649

4750
dev.o: $(SRC)
4851
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
4952
dev_usm.o: $(USM_SRC)
50-
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
53+
@#$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
54+
@echo USM is not supported for FPGAs, yet
55+
5156

5257

5358
vector-add-buffers_report.a: dev.o
5459
$(CXX) $(CXXFLAGS) -fintelfpga -fsycl-link $^ -o $@ -Xshardware
5560
vector-add-usm_report.a_usm: dev_usm.o
56-
$(CXX) $(CXXFLAGS) -fintelfpga -fsycl-link $^ -o $@ -Xshardware
61+
@#$(CXX) $(CXXFLAGS) -fintelfpga -fsycl-link $^ -o $@ -Xshardware
62+
@echo USM is not supported for FPGAs, yet
5763

5864

5965
clean:
60-
rm -rf *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers vector-add-buffers.fpga vector-add-usm.fpga *.a
66+
rm -rf *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers vector-add-buffers.fpga vector-add-usm.fpga *.a
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
CXX = dpcpp-cl
22
CXXFLAGS = -O2 -EHsc -Zi
33
LDFLAGS =
4-
EXE_NAME = vector-add-usm.exe
5-
SOURCES = src/vector-add-usm.cpp
4+
EXE_NAME = vector-add-buffers.exe
5+
SOURCES = src/vector-add-buffers.cpp
6+
7+
USM_EXE_NAME = vector-add-usm.exe
8+
USM_SOURCES = src/vector-add-usm.cpp
69

710
all: main
811

912
main:
1013
$(CXX) $(CXXFLAGS) -o $(EXE_NAME) $(SOURCES) $(LDFLAGS)
1114

15+
build_usm:
16+
$(CXX) $(CXXFLAGS) -o $(USM_EXE_NAME) $(USM_SOURCES) $(LDFLAGS)
17+
1218
run:
1319
$(EXE_NAME)
1420

21+
run_usm:
22+
$(USM_EXE_NAME)
23+
1524
clean:
16-
del -rf $(EXE_NAME)
25+
del /f $(EXE_NAME) $(USM_EXE_NAME)
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
CXX = dpcpp-cl
22
CXXFLAGS = -O2 -EHsc -Zi
33
LDFLAGS =
4-
SOURCES = src/vector-add-usm.cpp
5-
EXE_NAME_FPGA_EMU = vector-add-usm.fpga_emu.exe
4+
5+
SRC = src/vector-add-buffers.cpp
6+
USM_SRC = src/vector-add-usm.cpp
7+
8+
EXE = vector-add-buffers.fpga_emu.exe
9+
USM_EXE = vector-add-usm.fpga_emu.exe
610

711
all: fpga_emu
812

9-
fpga_emu:
10-
$(CXX) $(CXXFLAGS) -fintelfpga $(SOURCES) -o $(EXE_NAME_FPGA_EMU) -DFPGA_EMULATOR=1
13+
fpga_emu: $(SRC)
14+
$(CXX) $(CXXFLAGS) -fintelfpga $(SRC) -o $(EXE) -DFPGA_EMULATOR=1
15+
16+
fpga_emu_usm: $(SRC)
17+
@echo USM is not supported for FPGAs, yet
1118

1219
run:
13-
$(EXE_NAME_FPGA_EMU)
20+
$(EXE)
21+
22+
run_usm:
23+
@echo USM is not supported for FPGAs, yet
1424

1525
clean:
16-
del -rf $(EXE_NAME_FPGA_EMU)
26+
del /f *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers *.a $(EXE) $(USM_EXE)

DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ Perform the following steps:
4848
4949
### On a Windows* System Using a Command Line Interface
5050
1. Select **Programs** > **Intel oneAPI 2021** > **Intel oneAPI Command Prompt** to launch a command window.
51-
2. Build the program using the following `nmake` commands (Windows supports USM only):
51+
2. Build the program using the following `nmake` commands:
5252
```
5353
nmake -f Makefile.win
5454
```
55+
> Note: for USM use `nmake -f Makefile.win build_usm`
5556
5657
3. Run the program using:
5758
```
5859
nmake -f Makefile.win run
5960
```
61+
> Note: for USM use `nmake -f Makefile.win run_usm`
6062
6163
4. Clean the program using:
6264
```
@@ -127,7 +129,7 @@ Perform the following steps:
127129
128130
a. Select the **DPC++** tab.
129131
b. In the **General** subtab, the **Perform ahead of time compilation for the FPGA** setting is set to **Yes**.
130-
c. In the **Preprocessor** subtab, the **Preprocessor Definitions" setting has **FPGA_EMULATOR** added.
132+
c. In the **Preprocessor** subtab, the **Preprocessor Definitions" setting has **FPGA_EMULATOR=1** added.
131133
d. Close the dialog.
132134
133135
6. Select **Project** > **Build** menu option to build the selected configuration.

DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/sample.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"guid":"b1b58be7-e22e-4ca2-ba59-6887b2f1be6c",
23
"name": "Vector Add",
34
"categories": ["Toolkit/Get Started", "Toolkit/Intel® oneAPI Base Toolkit/oneAPI DPC++ Compiler/CPU, GPU and FPGA"],
45
"description": "Simple program that adds two large vectors in parallel. Provides a ‘Hello World!’ like sample to ensure your environment is setup correctly using simple Data Parallel C++.",

DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/src/vector-add-usm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int main() {
7676
#endif
7777

7878
try {
79-
queue q(default_selector{}, dpc::exception_handler);
79+
queue q(d_selector, dpc::exception_handler);
8080

8181
// Print out the device information used for the kernel code.
8282
std::cout << "Running on device: "
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
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-fpga|x64">
5+
<Configuration>Debug-fpga</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|x64">
9+
<Configuration>Debug</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Release-fpga|x64">
13+
<Configuration>Release-fpga</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{f11989d7-dcfe-404a-a893-e89084841327}</ProjectGuid>
24+
<Keyword>Win32Proj</Keyword>
25+
<RootNamespace>vector_add_buffers</RootNamespace>
26+
<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>Intel(R) oneAPI DPC++ Compiler</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-fpga|x64'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>true</UseDebugLibraries>
38+
<PlatformToolset>Intel(R) oneAPI DPC++ Compiler</PlatformToolset>
39+
<CharacterSet>Unicode</CharacterSet>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
42+
<ConfigurationType>Application</ConfigurationType>
43+
<UseDebugLibraries>false</UseDebugLibraries>
44+
<PlatformToolset>Intel(R) oneAPI DPC++ Compiler</PlatformToolset>
45+
<WholeProgramOptimization>true</WholeProgramOptimization>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-fpga|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>Intel(R) oneAPI DPC++ Compiler</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-fpga|x64'" Label="PropertySheets">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-fpga|x64'" Label="PropertySheets">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
74+
<LinkIncremental>true</LinkIncremental>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-fpga|x64'">
77+
<LinkIncremental>true</LinkIncremental>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
80+
<LinkIncremental>false</LinkIncremental>
81+
</PropertyGroup>
82+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-fpga|x64'">
83+
<LinkIncremental>false</LinkIncremental>
84+
</PropertyGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
86+
<ClCompile>
87+
<PrecompiledHeader>
88+
</PrecompiledHeader>
89+
<PrecompiledHeaderFile>
90+
</PrecompiledHeaderFile>
91+
</ClCompile>
92+
<Link>
93+
<SubSystem>Console</SubSystem>
94+
<GenerateDebugInformation>true</GenerateDebugInformation>
95+
</Link>
96+
</ItemDefinitionGroup>
97+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-fpga|x64'">
98+
<ClCompile>
99+
<PrecompiledHeader>
100+
</PrecompiledHeader>
101+
<PrecompiledHeaderFile>
102+
</PrecompiledHeaderFile>
103+
</ClCompile>
104+
<Link>
105+
<SubSystem>Console</SubSystem>
106+
<GenerateDebugInformation>true</GenerateDebugInformation>
107+
</Link>
108+
</ItemDefinitionGroup>
109+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
110+
<ClCompile>
111+
<PrecompiledHeader>
112+
</PrecompiledHeader>
113+
<PrecompiledHeaderFile>
114+
</PrecompiledHeaderFile>
115+
</ClCompile>
116+
<Link>
117+
<SubSystem>Console</SubSystem>
118+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
119+
<OptimizeReferences>true</OptimizeReferences>
120+
<GenerateDebugInformation>true</GenerateDebugInformation>
121+
</Link>
122+
</ItemDefinitionGroup>
123+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-fpga|x64'">
124+
<ClCompile>
125+
<PrecompiledHeader>
126+
</PrecompiledHeader>
127+
<PrecompiledHeaderFile>
128+
</PrecompiledHeaderFile>
129+
</ClCompile>
130+
<Link>
131+
<SubSystem>Console</SubSystem>
132+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
133+
<OptimizeReferences>true</OptimizeReferences>
134+
<GenerateDebugInformation>true</GenerateDebugInformation>
135+
</Link>
136+
</ItemDefinitionGroup>
137+
<ItemGroup>
138+
<ClCompile Include="src/vector-add-buffers.cpp" />
139+
</ItemGroup>
140+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
141+
<ImportGroup Label="ExtensionTargets">
142+
</ImportGroup>
143+
</Project>

0 commit comments

Comments
 (0)