Skip to content
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

[Refactor] Added Command Line Tool, Hardware-independent unittest, unified arithmetic operations, updated workflow, et al. #153

Merged
merged 23 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8ca9c14
[Refactor] Renamed inv -> reciprocal and unified the definition of ar…
hikettei May 24, 2024
1044cea
[Refactor] Fixed typos: leaky_relu, etc.
hikettei May 24, 2024
8a87f92
[Refactor] Removed scalarXXX impls
hikettei May 24, 2024
5a604dd
fix typo: inv -> reciprocal
hikettei May 24, 2024
e2c50e0
refactor: arithmetic ops, hw-independent tests
hikettei May 24, 2024
7d06b41
[refactor] fixed typo in in-place
hikettei May 25, 2024
021dcfe
fixed issues related to broadcasting and reshaping/bviewing
hikettei May 25, 2024
379c32d
passing all tests
hikettei May 25, 2024
6bbad2e
[Refactor] Updated Command Line developing tools
hikettei May 25, 2024
3478d09
[Refator] Make all tests hardware independent, and uses from fiveam t…
hikettei May 25, 2024
67d8070
[Refactor] Updated the documentation
hikettei May 25, 2024
f7eb206
Updated the badge
hikettei May 25, 2024
7fd3e64
updated the badge
hikettei May 25, 2024
541819c
[Refactor] Added demonstration calling from command line tool
hikettei May 25, 2024
b58cc79
[Enhancement] Added an ansi-colored timestamp and info system
hikettei May 25, 2024
32bb564
Merge branch 'develop', remote-tracking branch 'origin' into refactor
hikettei May 25, 2024
ed3ce05
[Workflow] Fixed indentation
hikettei May 25, 2024
60b62f5
[Enhancement] added --config options, mlp generates a file which reco…
hikettei May 25, 2024
f2cb2a3
[Workflow] Installing SIMD Extension, checking accuracy, et al.
hikettei May 25, 2024
eb94aba
[Workflow] Added sudo
hikettei May 25, 2024
8b1e609
[Workflow] Removed Installing Extension step
hikettei May 25, 2024
3f252df
[Workflow] epoch-num=2
hikettei May 25, 2024
55121d7
Update test_on_push.yml
hikettei May 25, 2024
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
95 changes: 59 additions & 36 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# TODO: Metal/CUDA Runtime
UnitTest-CPUTensor:
# TODO: Metal/CUDA Runtime
name: ${{ matrix.lisp }} on ${{ matrix.os }}
name: (${{ matrix.os }} on ${{ matrix.lisp }}) | Unittest-CPUTensor
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -41,12 +41,19 @@ jobs:
- name: Installing OpenBLAS
run: |
sudo apt install libblas-dev

#- name: Installing Extensions
# run: |
# git submodule update --init --recursive
# sudo make build_sleef
# sudo make build_simd_extension

- name: Unittest (CPU+Lisp)
run: |
ros config set dynamic-space-size 4gb
./roswell/waffe2.ros test -b CPUTensor -b LispTensor
UnitTest-LispTensor:
name: ${{ matrix.lisp }} on ${{ matrix.os }}
name: (${{ matrix.os }} on ${{ matrix.lisp }}) | Unittest-LispTensor
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -73,39 +80,55 @@ jobs:
ros config set dynamic-space-size 4gb
./roswell/waffe2.ros test -b LispTensor -b CPUTensor
Test-Classification-CPU:
- uses: actions/checkout@v1
- name: Setting up environments
env:
LISP: ${{ matrix.lisp }}
run: |
curl -L https://raw.githubusercontent.com/roswell/roswell/master/scripts/install-for-ci.sh | sh
- name: Update $PATH
run: |
echo $PATH
echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV
- name: Check $PATH
run: echo $PATH

- name: Installing OpenBLAS
run: |
sudo apt install libblas-dev

- name: Set up Python
id: set_up_python_python_ci
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Downloading assets
run: |
pip install torch torchvision numpy
cd ./examples/mnist
python train_data.py
cd ../../

- name: Training (CPUTensor)
run: |
ros config set dynamic-space-size 4gb
./roswell/waffe2.ros demo --example mnist -b CPUTensor -b LispTensor
name: (${{ matrix.os }} on ${{ matrix.lisp }}) | Test-Classification-CPU
runs-on: ${{ matrix.os }}
strategy:
matrix:
lisp: [sbcl-bin/2.3.9]
os: [ubuntu-latest]
target:
- normal
archcpu:
- AVX2
steps:
- uses: actions/checkout@v1
- name: Setting up environments
env:
LISP: ${{ matrix.lisp }}
run: |
curl -L https://raw.githubusercontent.com/roswell/roswell/master/scripts/install-for-ci.sh | sh
- name: Update $PATH
run: |
echo $PATH
echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV
- name: Check $PATH
run: echo $PATH
- name: Installing OpenBLAS
run: |
sudo apt install libblas-dev

- name: Set up Python
id: set_up_python_python_ci
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Downloading assets
run: |
pip install torch torchvision numpy
cd ./examples/mnist
python train_data.py
cd ../../

#- name: Installing Extensions
# run: |
# git submodule update --init --recursive
# sudo make build_sleef
# sudo make build_simd_extension

- name: Training w/ LispTensor
run: |
ros config set dynamic-space-size 4gb
./roswell/waffe2.ros demo --example mnist -b LispTensor -b CPUTensor --config epoch-num=2


20 changes: 11 additions & 9 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
ROSWELL := ros
SBCL := sbcl
# Avoid loading system-wide libraries (--no-sysinit)
SBCL_OPTIONS := --noinform --no-sysinit
QUICKLOAD_WAFFE2 := --load cl-waffe2.asd --eval '(ql:quickload :cl-waffe2)'
ROSWELL_OPTIONS := dynamic-space-size=4096
QUICKLOAD_WAFFE2 := --eval '(load "cl-waffe2.asd")' --eval '(ql:quickload :cl-waffe2)'
MKTEMP := mktemp
RLWRAP := rlwrap
LOGFILE := $(shell mktemp)
Expand All @@ -26,32 +28,32 @@ compile: ## Compiles the whole project

.PHONY: test
test: ## Running a test harness
$(SBCL) $(SBCL_OPTIONS) $(QUICKLOAD_WAFFE2) \
$(ROSWELL) run $(ROSWELL_OPTIONS) $(QUICKLOAD_WAFFE2) \
--eval '(asdf:test-system :cl-waffe2)' \
--quit

.PHONY: recordtest
recordtest: ## Running a test harness with recording logs
$(warning This session will be recorded in $(LOGFILE))
$(RLWRAP) --logfile $(LOGFILE) \
$(SBCL) $(SBCL_OPTIONS) $(QUICKLOAD_WAFFE2) \
$(ROSWELL) run $(ROSWELL_OPTIONS) $(QUICKLOAD_WAFFE2) \
--eval '(asdf:test-system :cl-waffe2)' \
--quit
@printf 'This session has been recorded in %s\n' $(LOGFILE)

.PHONY: repl
repl: ## Launch REPL with loading cl-waffe2
$(SBCL) $(SBCL_OPTIONS) $(QUICKLOAD_WAFFE2)
$(ROSWELL) run $(ROSWELL_OPTIONS) $(QUICKLOAD_WAFFE2)

.PHONY: rlrepl
rlrepl: ## Launch REPL with rlwrap
$(RLWRAP) $(SBCL) $(SBCL_OPTIONS) $(QUICKLOAD_WAFFE2)
$(RLWRAP) $(ROSWELL) run $(ROSWELL_OPTIONS) $(QUICKLOAD_WAFFE2)

.PHONY: record
record: ## Launch REPL with logging
$(warning This session will be recorded in $(LOGFILE))
$(RLWRAP) --logfile $(LOGFILE) \
$(SBCL) $(SBCL_OPTIONS) $(QUICKLOAD_WAFFE2)
$(ROSWELL) run $(ROSWELL_OPTIONS) $(QUICKLOAD_WAFFE2)
@printf 'This session has been recorded in %s\n' $(LOGFILE)

.PHONY: slynk
Expand All @@ -68,7 +70,7 @@ swank: ## Launch Swank server

.PHONY: docs
docs: ## Generate documents
$(SBCL) $(SBCL_OPTIONS) $(QUICKLOAD_WAFFE2) \
$(ROSWELL) run $(ROSWELL_OPTIONS) $(QUICKLOAD_WAFFE2) \
--eval '(ql:quickload :cl-waffe2/docs)' \
--eval '(cl-waffe2.docs:generate)' \
--quit
Expand Down Expand Up @@ -139,14 +141,14 @@ download_assets: ## Downloads training data sample codes use.

.PHONY: example_mnist
example_mnist: ## Start MNIST Example and Benchmarking. (download_assets must be called in advance)
$(SBCL) $(SBCL_OPTIONS) \
$(ROSWELL) run $(ROSWELL_OPTIONS) \
--load ./cl-waffe2.asd --load ./examples/mnist/mnist.asd \
--eval '(ql:quickload :mnist-sample)' \
--eval '(mnist-sample::train-and-valid-mlp :epoch-num 10)'

.PHONY: example_gpt
example_gpt: ## Launch GPT2 Inference (download_assets must be called in advance)
$(SBCL) --dynamic-space-size 4096 $(SBCL_OPTIONS) \
$(ROSWELL) run $(ROSWELL_OPTIONS) \
--load ./cl-waffe2.asd --load ./examples/gpt-2/gpt-2.asd \
--eval '(ql:quickload :gpt-2-example)' \
--eval '(gpt-2-example:launch-repl)'
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</p>
</p>

[![CI](https://github.com/hikettei/cl-waffe2/actions/workflows/Cl.yml/badge.svg?branch=master)](https://github.com/hikettei/cl-waffe2/actions/workflows/Cl.yml)
[![CI](https://github.com/hikettei/cl-waffe2/actions/workflows/test_on_push.yml/badge.svg?branch=master)](https://github.com/hikettei/cl-waffe2/actions/workflows/test_on_push.yml)

# cl-waffe2

Expand Down
21 changes: 5 additions & 16 deletions cl-waffe2.asd
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
:description "Tests for cl-waffe2"
:serial t
:pathname "source"
:depends-on (:cl-waffe2 :fiveam)
:depends-on (:cl-waffe2 :fiveam :rove)
:components ((:file "vm/iterator/test-suites")
(:file "vm/t/package")
(:file "vm/t/lazy-axis")
Expand Down Expand Up @@ -259,22 +259,11 @@
(:file "nn/t/conv")
(:file "nn/t/activation")
(:file "nn/t/criterion")
(:file "nn/t/regression")
(:file "nn/t/regression")

(:file "test-suites")
)
:perform (test-op (o s)
(symbol-call :fiveam :run! :iterator-test)
(symbol-call :fiveam :run! :test-nodes)
(symbol-call :fiveam :run! :test-tensor)

(symbol-call :fiveam :run! :base-impl-test)
(symbol-call :fiveam :run! :jit-lisp-test)

(symbol-call :fiveam :run! :lisp-backend-test)
(symbol-call :fiveam :run! :test-backends-cpu)
(symbol-call :fiveam :run! :jit-cpu-test)

(symbol-call :fiveam :run! :nn-test)
(symbol-call :fiveam :run! :vm-test)))
:perform (test-op (o s) (error "moved to source/test-suites.lisp")))


(defpackage :cl-waffe2-docs-asdf
Expand Down
6 changes: 3 additions & 3 deletions docs/apis/nn.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
(with-example
"(proceed (!sigmoid (randn `(10 10))))"))

(with-nn-doc '!leakey-relu 'function
(with-nn-doc '!leaky-relu 'function
(with-example
"(proceed (!leakey-relu (randn `(10 10))))"))
"(proceed (!leaky-relu (randn `(10 10))))"))

(with-nn-doc '!elu 'function
(with-example
"(proceed (!leakey-relu (randn `(10 10))))"))
"(proceed (!elu (randn `(10 10))))"))

(with-nn-doc '!softmax 'function
(with-example
Expand Down
9 changes: 1 addition & 8 deletions docs/apis/reference.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ The package `cl-waffe2/vm` is the central of system, and features are focused on
(nodedoc SubNode)
(nodedoc MulNode)
(nodedoc DivNode)

(nodedoc InverseTensorNode)

(nodedoc ScalarAdd)
(nodedoc ScalarSub)
(nodedoc ScalarMul)
(nodedoc ScalarDiv)

(nodedoc MoveTensorNode)

Expand Down Expand Up @@ -158,7 +151,7 @@ The package `cl-waffe2/vm` is the central of system, and features are focused on
(caller-doc !matrix-mul)
(caller-doc !matrix-div)

(caller-doc !inverse)
(caller-doc !reciprocal)
(caller-doc !scalar-add)
(caller-doc !scalar-sub)
(caller-doc !scalar-mul)
Expand Down
Loading
Loading