Skip to content

Commit

Permalink
Merge pull request #200 from DLTcollab/develop
Browse files Browse the repository at this point in the history
Pre-release v0.5.0
  • Loading branch information
marktwtn committed Oct 2, 2019
2 parents 030c6e0 + c5720d2 commit 9af463b
Show file tree
Hide file tree
Showing 25 changed files with 375 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .auto-changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"template": "changelog.hbs",
"issuePattern": "fix.*:"
}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "deps/rabbitmq-c"]
path = deps/rabbitmq-c
url = https://github.com/alanxz/rabbitmq-c.git
[submodule "deps/sse2neon"]
path = deps/sse2neon
url = https://github.com/DLTcollab/sse2neon.git
26 changes: 26 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"hooks": {
"before:github:release": [
"make BUILD_REMOTE=1 BUILD_DEBUG=1 BOARD=de10nano BUILD_FPGA_ACCEL=1",
"tar zcvf remote-worker.tar.gz --directory=build remote-worker"
]
},
"git": {
"changelog": "npx auto-changelog --stdout",
"requireUpstream": false,
"commit": false,
"tag": true,
"tagName": "v${version}",
"push": false
},
"github": {
"release": true,
"releaseName": "v${version}",
"preRelease": true,
"draft": true,
"tokenRef": "GITHUB_TOKEN",
"assets": [
"remote-worker.tar.gz"
]
}
}
7 changes: 6 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "dcurl"
PROJECT_NUMBER = 0.1.0
PROJECT_NUMBER = 0.5.0
OUTPUT_DIRECTORY = docs
OPTIMIZE_OUTPUT_FOR_C = YES
#---------------------------------------------------------------------------
Expand All @@ -17,6 +17,7 @@ INPUT = . \
src
FILE_PATTERNS = dcurl.c \
dcurl.h \
cpu-utils.h \
*.md
USE_MDFILE_AS_MAINPAGE = README.md
#---------------------------------------------------------------------------
Expand All @@ -27,6 +28,10 @@ INLINE_SOURCES = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_STATIC = YES
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = 0.4.1
VERSION = 0.5.0

OUT ?= ./build
SRC := src
Expand Down
19 changes: 19 additions & 0 deletions changelog.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{#with releases.[0]}}

## {{title}} {{#if niceDate}}({{niceDate}}){{/if}}

### :tada: New Features

{{#commit-list merges heading="" message='feat.*: '}}
- {{{message}}} ({{commit.shorthash}})
{{/commit-list}}

{{#commit-list commits heading="" message='feat.*: '}}
- {{{subject}}} ({{shorthash}})
{{/commit-list}}

{{#commit-list fixes heading='### :bug: Bug Fixes'}}
- {{commit.subject}} ({{commit.shorthash}})
{{/commit-list}}

{{/with}}
1 change: 1 addition & 0 deletions deps/sse2neon
Submodule sse2neon added at d88df3
126 changes: 126 additions & 0 deletions docs/board-de10-nano.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Execute dcurl remote worker on the [DE10-Nano](https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&No=1046) board
## Write the image file to the micro SD card
Prepare a micro SD card reader for writing the image file.

The command for writing the image file to the micro SD card:
### Linux
```bash
$ sudo dd if=[image-file] of=/dev/sd[x] bs=1M status=progress
```
**Important**:\
Please make sure to fill the correct **[x]** value in `/dev/sd[x]`.\
It must map to the micro SD card. Otherwise, your hard disk will be broken.\
You can check it with the command `$ sudo fdisk -l`.

### macOS
```bash
$ sudo dd if=[image-file] of=/dev/mmcblk[x] bs=1M status=progress
```
**Important**:\
Please make sure to fill the correct **[x]** value in `/dev/mmcblk[x]`.


## Hardware manual setting
Change the FPGA configuration mode switch as shown in the image\
<img src="https://forum.uvm.io/uploads/default/original/1X/e09be635519a0af23ad88baed8ef99d06941eca4.png" width="600">


## Connect with the De10-Nano board
### Hardware
Please make sure the following list are well set or connected:
- 5V DC Power Jack
- UART to USB (USB Mini-B)
- HPS Gigabit Ethernet
- MicroSD Card Socket
<img src="https://software.intel.com/sites/default/files/did_feeds_images/76220cfd-83d7-49b0-a8c3-be8a2728a6e6/76220cfd-83d7-49b0-a8c3-be8a2728a6e6-imageId=7376634d-da28-4a76-bf64-7c97648f4fe6.jpg" width="600">
<img src="https://software.intel.com/sites/default/files/did_feeds_images/76220cfd-83d7-49b0-a8c3-be8a2728a6e6/76220cfd-83d7-49b0-a8c3-be8a2728a6e6-imageId=5fba4448-b09b-4aa4-afaa-99572005b99e.jpg" width="600">

### Minicom
Use **minicom** to connect with the **DE10-Nano** board.
#### Install minicom
##### Linux
```bash
$ sudo apt install minicom
```
##### macOS
```bash
$ sudo brew install minicom
```

#### Configure minicom
```bash
$ sudo minicom -s
```
Select **Serial port setup** and configure as the following
##### Linux
```
┌─────────────────────────────────────────────────────────────────┐
│ A - Serial Device : /dev/ttyUSB0 │
│ B - Lockfile Location : /var/lock │
│ C - Callin Program : │
│ D - Callout Program : │
│ E - Bps/Par/Bits : 115200 8N1 │
│ F - Hardware Flow Control : No │
│ G - Software Flow Control : No │
│ │
│ Change which setting? │
└─────────────────────────────────────────────────────────────────┘
```

##### macOS
```
┌─────────────────────────────────────────────────────────────────┐
│ A - Serial Device : /dev/tty.usbserial-A107T0EA │
│ B - Lockfile Location : /usr/local/Cellar/minicom/2.7.1/var │
│ C - Callin Program : │
│ D - Callout Program : │
│ E - Bps/Par/Bits : 115200 8N1 │
│ F - Hardware Flow Control : No │
│ G - Software Flow Control : No │
│ │
│ Change which setting? │
└─────────────────────────────────────────────────────────────────┘
```

If you want to change the value of `Serial Device`, press **Ctrl-A**.

After configuration, select **Save setup as dfl** and select **Exit from Minicom** to exit.

#### Connect with minicom
```bash
$ sudo minicom
```
Then enter the user account and the password to login.


## Build and execute the remote worker
### Load the driver
You need to load the driver first for the further execution of the remote worker.\
Otherwise, it will crash.
```bash
$ sudo insmod cpowdrv.ko
```

### Clone the repository
```bash
$ git clone git@github.com:DLTcollab/dcurl.git
```

### Build the remote worker
```bash
$ cd dcurl
$ make BUILD_REMOTE=1 BOARD=de10nano BUILD_FPGA_ACCEL=1
```

### Execute the remote worker
```bash
$ sudo ./build/remote-worker --broker [rabbitmq-broker-hostname]
```
Use **-b** or **--broker** to assign the hostname of the RabbitMQ broker.\
The default value is **localhost**.


## Reference
- [Terasic DE10-Nano Product Brief](https://www.mouser.tw/pdfdocs/de10NanoBrief.pdf)
- [Terasic DE10-Nano Get Started Guide](https://software.intel.com/en-us/terasic-de10-nano-get-started-guide)
- [Linux on ARM - DE10-Nano Kit](https://www.digikey.com/eewiki/display/linuxonarm/DE10-Nano+Kit)
Empty file modified docs/fpga-accelerator.md
100755 → 100644
Empty file.
20 changes: 20 additions & 0 deletions docs/release-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Release Workflow

The motivation of release workfow is to update the GitHub release page
when there is a new tag pushed to the GitHub.

The release workflow uses `auto-changelog` utility to generate the
changelog, then use `release-it` utility to publish the changelog
on the release page.

The `release-it` will also build the `remote-worker`, and upload the
packed the `remote-worker` to release page.

- `.release-it`: `release-it` configuration file
- `.auto-changelog`: `auto-changelog` configuration file
- `changelog.hbs`: changelog template file

## Reference

- [release-it/release-it](https://github.com/release-it/release-it)
- [CookPete/auto-changelog](https://github.com/CookPete/auto-changelog)
3 changes: 3 additions & 0 deletions docs/remote-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Here are detailed implementations of the RabbitMQ-provided RPC pattern as follow
* An asynchronous RPC uses a connection to RabbitMQ broker
* Remote workers can obtain requests from `incoming_queue` by default exchange of RabbitMQ broker

The remote worker can be executed on the different hardwares and do the PoW.\
For executing it on DE10-Nano board, please read the [docs/board-de10-nano.md](board-de10-nano.md).

## How to test remote interface in localhost
You need to open three terminals

Expand Down
5 changes: 1 addition & 4 deletions docs/threading-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
In `dcurl`, it calls the APIs provided by the `libtuv` submodule to use the threads and thread pool.

## Thread pool size
The thread pool size initialization is written in the function `init_once()`.\
The environment variable `UV_THREADPOOL_SIZE` can be used to overwrite the default pool size.\
The thread pool size can be set with the function `uv_set_threadpool_size()`.\
Default pool size: 4\
Maximum pool size: 128

The current `dcurl` implementation can not affect the thread pool size.

## Thread pool mechanism
The thread pool and the work request queue are global.\
Work request can be treated as the function you would like to request the thread to execute.
Expand Down
13 changes: 13 additions & 0 deletions mk/submodule.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ endif
cd $(LIBRABBITMQ_PATH)/build && \
cmake --build .

# sse2neon related variables
SSE2NEON_PATH = deps/sse2neon
SSE2NEON_INCLUDE := -I $(SSE2NEON_PATH)

$(SSE2NEON_PATH)/sse2neon.h:
git submodule update --init $(SSE2NEON_PATH)

# Submodules
SUBS := $(LIBTUV_PATH)/include
ifeq ($(BUILD_REMOTE),1)
SUBS += $(LIBRABBITMQ_PATH)/librabbitmq
endif
ifeq ($(UNAME_M),$(filter $(UNAME_M),arm aarch64))
SUBS += $(SSE2NEON_PATH)/sse2neon.h
endif
# Submodule related objects
SUB_OBJS := $(LIBTUV_OBJS)
ifeq ($(BUILD_REMOTE),1)
Expand All @@ -69,3 +79,6 @@ SUB_INCLUDE := $(LIBTUV_INCLUDE)
ifeq ($(BUILD_REMOTE),1)
SUB_INCLUDE += $(LIBRABBITMQ_INCLUDE)
endif
ifeq ($(UNAME_M),$(filter $(UNAME_M),arm aarch64))
SUB_INCLUDE += $(SSE2NEON_INCLUDE)
endif
4 changes: 2 additions & 2 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <time.h>

#define __DCURL_MAJOR__ 0
#define __DCURL_MINOR__ 4
#define __DCURL_PATCH__ 1
#define __DCURL_MINOR__ 5
#define __DCURL_PATCH__ 0

double diff_in_second(struct timespec t1, struct timespec t2);

Expand Down
Loading

0 comments on commit 9af463b

Please sign in to comment.