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

Updated Jenkins Shared Library, XTC tools version, and improved throughput example #81

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
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
63 changes: 33 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('xmos_jenkins_shared_library@v0.28.0')
@Library('xmos_jenkins_shared_library@v0.35.0')

def runningOn(machine) {
println "Stage running on:"
Expand All @@ -12,23 +12,14 @@ def buildApps(appList) {
}
}

def buildDocs(String zipFileName) {
withVenv {
sh 'pip install git+ssh://[email protected]/xmos/xmosdoc'
sh 'xmosdoc'
zip zipFile: zipFileName, archive: true, dir: "doc/_build"
}
}


getApproval()

pipeline {
agent none
parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.2.1',
defaultValue: '15.3.0',
description: 'The tools version to build with (check /projects/tools/ReleasesTools/)'
)
} // parameters
Expand Down Expand Up @@ -80,23 +71,35 @@ pipeline {
}
}
}
stage('Build') {
steps {
sh "git clone -b develop [email protected]:xmos/xcommon_cmake ${WORKSPACE}/xcommon_cmake"
dir('xscope_fileio') {
withTools(params.TOOLS_VERSION) {
withEnv(["XMOS_CMAKE_PATH=${WORKSPACE}/xcommon_cmake"]) {
buildApps([
"examples/fileio_features_xc",
"examples/throughput_c",
"tests/no_hang",
"tests/close_files",
]) // buildApps
} // withEnv
} // withTools
} // dir
} // steps
} // stage 'Build'

stage('Build examples') {
steps {
dir("xscope_fileio/examples") {
withTools(params.TOOLS_VERSION) {
script {
// Build all apps in the examples directory
sh 'cmake -B build -G "Unix Makefiles" -DDEPS_CLONE_SHALLOW=TRUE'
sh 'xmake -C build'
} // script
} // withTools
} // dir
} // steps
} // Build examples

stage('Build tests') {
steps {
dir("xscope_fileio/tests") {
withTools(params.TOOLS_VERSION) {
script {
// Build all apps in the examples directory
sh 'cmake -B build -G "Unix Makefiles" -DDEPS_CLONE_SHALLOW=TRUE'
sh 'xmake -C build'
} // script
} // withTools
} // dir
} // steps
} // Build examples

stage('Cleanup xtagctl'){
steps {
dir('xscope_fileio') {
Expand Down Expand Up @@ -140,7 +143,7 @@ pipeline {

withTools(params.TOOLS_VERSION) {
dir('host') {
withVS("vcvars32.bat") {
withVS("vcvars64.bat") {
sh 'cmake -G "Ninja" .'
sh 'ninja'
}
Expand Down Expand Up @@ -186,7 +189,7 @@ pipeline {
checkout scm
createVenv("requirements.txt")
withTools(params.TOOLS_VERSION) {
buildDocs("xscope_fileio.zip")
buildDocs(archiveZipOnly: true)
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(xscope_fileio)
add_subdirectory(throughput_c)
add_subdirectory(fileio_features_xc)
2 changes: 1 addition & 1 deletion examples/fileio_features_xc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(fileio_features_xc)

# sandbox
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)

# target ans srcs
set(APP_HW_TARGET XCORE-AI-EXPLORER)
Expand Down
29 changes: 0 additions & 29 deletions examples/fileio_features_xc/Makefile

This file was deleted.

3 changes: 1 addition & 2 deletions examples/fileio_features_xc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Build example (using xcommon_cmake)

.. warning::

Make sure ``xscope_fileio`` host application is installed.
Make sure ``XCOMMON_CMAKE_PATH`` environment variable is set to the directory where ``xcommon_cmake`` is located.
Make sure ``xscope_fileio`` python package and host application are installed.

Run the following command from the current directory:

Expand Down
5 changes: 2 additions & 3 deletions examples/throughput_c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(fileio_test)

# sandbox
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)

# target ans srcs
set(APP_HW_TARGET XCORE-AI-EXPLORER)
set(APP_XC_SRCS main.xc)
set(APP_C_SRCS test.c)
set(APP_C_SRCS main.c)

# flags
set(APP_COMPILER_FLAGS
Expand Down
47 changes: 0 additions & 47 deletions examples/throughput_c/Makefile

This file was deleted.

6 changes: 3 additions & 3 deletions examples/throughput_c/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Build example (using xcommon_cmake)

.. warning::

Make sure ``xscope_fileio`` host application is installed.
Make sure ``XCOMMON_CMAKE_PATH`` environment variable is set to the directory where ``xcommon_cmake`` is located.
Make sure ``xscope_fileio`` python package and host application are installed.

Run the following command from the current directory:

Expand All @@ -30,4 +29,5 @@ Run the following command from top-level directory:
Output
------

The output will be several files in the current directory inside the output folder.
The example writes and reads files on the host computer and measures the KBPS throughput. Once finished, the measurements are displayed on the console.

16 changes: 11 additions & 5 deletions examples/throughput_c/test.c → examples/throughput_c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ void do_test(void){
unsigned t3 = get_reference_time();
write_total_time += t3 - t2;
} while(num_bytes > 0);





printf("Throughput KBPS Read: %f, Write: %f\n", ticks_to_KBPS(read_total_time, fsize), ticks_to_KBPS(write_total_time, fsize));
printf("Throughput KBPS Read: %f, Write: %f\n",
ticks_to_KBPS(read_total_time, fsize),
ticks_to_KBPS(write_total_time, fsize));
}

void main_tile0(chanend_t xscope_chan)
Expand All @@ -63,3 +61,11 @@ void main_tile0(chanend_t xscope_chan)
do_test();
xscope_close_all_files();
}

int main(){
chanend_t xscope_chan = chanend_alloc();
xscope_io_init(xscope_chan);
main_tile0(xscope_chan);
chanend_free(xscope_chan);
return 0;
}
21 changes: 0 additions & 21 deletions examples/throughput_c/main.xc

This file was deleted.

5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(xscope_fileio_tests)
add_subdirectory(no_hang)
add_subdirectory(close_files)
2 changes: 1 addition & 1 deletion tests/close_files/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(xscope_fileio_close)

# sandbox
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
message("XMOS_SANDBOX_DIR: ${XMOS_SANDBOX_DIR}")

# target
Expand Down
2 changes: 1 addition & 1 deletion tests/no_hang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(no_hang)

# sandbox
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
message("XMOS_SANDBOX_DIR: ${XMOS_SANDBOX_DIR}")

# target
Expand Down