Skip to content

updated vector-add to remove dpc_common.hpp dependency #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ run_usm:
./$(USM_EXE_NAME)

clean:
rm -rf $(BUFFER_EXE_NAME) $(USM_EXE_NAME)
rm -f $(BUFFER_EXE_NAME) $(USM_EXE_NAME)
28 changes: 17 additions & 11 deletions DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/Makefile.fpga
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CXXFLAGS = -O2 -g -std=c++17
SRC := src/vector-add-buffers.cpp
USM_SRC := src/vector-add-usm.cpp

.PHONY: fpga_emu run_emu clean
.PHONY: fpga_emu run_emu fpga_emu_usm run_emu_usm clean

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


a.o: $(SRC)
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
a_usm.o: $(USM_SRC)
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1

@#$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
@echo USM is not supported for FPGAs, yet

vector-add-buffers.fpga: a.o
$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware
vector-add-usm.fpga: a_usm.o
$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware
@#$(CXX) $(CXXFLAGS) -fintelfpga $^ -o $@ -Xshardware
@echo USM is not supported for FPGAs, yet

run_emu: vector-add-buffers.fpga_emu
./vector-add-buffers.fpga_emu
run_emu_usm: vector-add-usm.fpga_emu_usm
./vector-add-usm.fpga_emu_usm
@#./vector-add-usm.fpga_emu_usm
@echo USM is not supported for FPGAs, yet


run_hw: vector-add-buffers.fpga
./vector-add-buffers.fpga
run_hw_usm: vector-add-usm.fpga
./vector-add-usm.fpga

@#./vector-add-usm.fpga
@echo USM is not supported for FPGAs, yet

dev.o: $(SRC)
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
dev_usm.o: $(USM_SRC)
$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
@#$(CXX) $(CXXFLAGS) -fintelfpga -c $^ -o $@ -DFPGA=1
@echo USM is not supported for FPGAs, yet



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


clean:
rm -rf *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers vector-add-buffers.fpga vector-add-usm.fpga *.a
rm -f *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers vector-add-buffers.fpga vector-add-usm.fpga *.a
15 changes: 12 additions & 3 deletions DirectProgramming/DPC++/DenseLinearAlgebra/vector-add/Makefile.win
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
CXX = dpcpp-cl
CXXFLAGS = -O2 -EHsc -Zi
LDFLAGS =
EXE_NAME = vector-add-usm.exe
SOURCES = src/vector-add-usm.cpp
EXE_NAME = vector-add-buffers.exe
SOURCES = src/vector-add-buffers.cpp

USM_EXE_NAME = vector-add-usm.exe
USM_SOURCES = src/vector-add-usm.cpp

all: main

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

build_usm:
$(CXX) $(CXXFLAGS) -o $(USM_EXE_NAME) $(USM_SOURCES) $(LDFLAGS)

run:
$(EXE_NAME)

run_usm:
$(USM_EXE_NAME)

clean:
del -rf $(EXE_NAME)
del /f $(EXE_NAME) $(USM_EXE_NAME)
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
CXX = dpcpp-cl
CXXFLAGS = -O2 -EHsc -Zi
LDFLAGS =
SOURCES = src/vector-add-usm.cpp
EXE_NAME_FPGA_EMU = vector-add-usm.fpga_emu.exe

SRC = src/vector-add-buffers.cpp
USM_SRC = src/vector-add-usm.cpp

EXE = vector-add-buffers.fpga_emu.exe
USM_EXE = vector-add-usm.fpga_emu.exe

all: fpga_emu

fpga_emu:
$(CXX) $(CXXFLAGS) -fintelfpga $(SOURCES) -o $(EXE_NAME_FPGA_EMU) -DFPGA_EMULATOR=1
fpga_emu: $(SRC)
$(CXX) $(CXXFLAGS) -fintelfpga $(SRC) -o $(EXE) -DFPGA_EMULATOR=1

fpga_emu_usm: $(SRC)
@echo USM is not supported for FPGAs, yet

run:
$(EXE_NAME_FPGA_EMU)
$(EXE)

run_usm:
@echo USM is not supported for FPGAs, yet

clean:
del -rf $(EXE_NAME_FPGA_EMU)
del /f *.o *.d *.out *.mon *.emu *.aocr *.aoco *.prj *.fpga_emu *.fpga_emu_buffers *.a $(EXE) $(USM_EXE)
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ Perform the following steps:

### On a Windows* System Using a Command Line Interface
1. Select **Programs** > **Intel oneAPI 2021** > **Intel oneAPI Command Prompt** to launch a command window.
2. Build the program using the following `nmake` commands (Windows supports USM only):
2. Build the program using the following `nmake` commands:
```
nmake -f Makefile.win
```
> Note: for USM use `nmake -f Makefile.win build_usm`

3. Run the program using:
```
nmake -f Makefile.win run
```
> Note: for USM use `nmake -f Makefile.win run_usm`

4. Clean the program using:
```
Expand Down Expand Up @@ -127,7 +129,7 @@ Perform the following steps:

a. Select the **DPC++** tab.
b. In the **General** subtab, the **Perform ahead of time compilation for the FPGA** setting is set to **Yes**.
c. In the **Preprocessor** subtab, the **Preprocessor Definitions" setting has **FPGA_EMULATOR** added.
c. In the **Preprocessor** subtab, the **Preprocessor Definitions" setting has **FPGA_EMULATOR=1** added.
d. Close the dialog.

6. Select **Project** > **Build** menu option to build the selected configuration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"guid":"b1b58be7-e22e-4ca2-ba59-6887b2f1be6c",
"name": "Vector Add",
"categories": ["Toolkit/Get Started", "Toolkit/Intel® oneAPI Base Toolkit/oneAPI DPC++ Compiler/CPU, GPU and FPGA"],
"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++.",
Expand Down

This file was deleted.

Loading