-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from nhatdongdang/feature/final-working-program
Make base program compatible with speed_cpu.sh and add CI workflow
- Loading branch information
Showing
12 changed files
with
312 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: main | ||
paths: ['**.cu','**.c','**.cpp', '**.h', '**CMakeLists.txt'] | ||
pull_request: | ||
branches: main | ||
paths: ['**.cu','**.c','**.cpp', '**.h', '**CMakeLists.txt'] | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install pandas | ||
- name: Build project | ||
run: | | ||
make build | ||
- name: Run test suite | ||
run: | | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: cpp-linter | ||
on: | ||
pull_request: | ||
branches: main | ||
paths: ['**.cu','**.cpp','**.c', '**.h', '**CMakeLists.txt'] | ||
push: | ||
branches: main | ||
paths: ['**.cu','**.cpp','**.c', '**.h', '**CMakeLists.txt'] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
actions: write | ||
|
||
jobs: | ||
cpp-linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cpp-linter/cpp-linter-action@v2 | ||
id: linter | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
style: 'file' # Use .clang-format config file. | ||
tidy-checks: '-*' # disable clang-tidy checks. | ||
version: 17 | ||
thread-comments: true | ||
format-review: true | ||
|
||
- name: Run clang-format | ||
if: steps.linter.outputs.clang-format-checks-failed > 0 | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,8 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
# misc | ||
.vscode | ||
build | ||
results.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
.PHONY: all test clean run build run_test | ||
|
||
clean: | ||
rm -rf build | ||
rm speed_cpu | ||
|
||
build: | ||
cmake -Bbuild | ||
$(MAKE) -C ./build | ||
mv ./build/speed_cpu ./ | ||
|
||
run: build | ||
./speed_demo_cpu.sh ./weights_and_biases.txt ./tensors | ||
|
||
run_test: build | ||
./speed_cpu ./weights_and_biases.txt ./tensors | ||
|
||
test: build | ||
./speed_demo_cpu.sh ./weights_and_biases.txt ./tensors | ||
mv ./results.csv ./test | ||
python3 ./test/verify_csv.py | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
typedef struct { | ||
int rows; | ||
int cols; | ||
float** data; | ||
} matrix; | ||
|
||
matrix* createMatrix(int rows, int cols); | ||
|
||
void multiplyMatrices(const matrix* a, const matrix* b, const matrix* result); | ||
|
||
void addMatrix(matrix* a, const matrix* b); | ||
|
||
void ReLU(matrix* a); | ||
|
||
void softmax(matrix* a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
char letters[52] = {'A', 'a', 'B', 'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f', 'G', 'g', 'H', 'h', 'I', 'i', | ||
'J', 'j', 'K', 'k', 'L', 'l', 'M', 'm', 'N', 'n', 'O', 'o', 'P', 'p', 'Q', 'q', 'R', 'r', | ||
'S', 's', 'T', 't', 'U', 'u', 'V', 'v', 'W', 'w', 'X', 'x', 'Y', 'y', 'Z', 'z'}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.