From c87e2f9bf0fefdbb4f439a0b082d4093b49ce6b3 Mon Sep 17 00:00:00 2001 From: Ashar Date: Wed, 1 Jul 2020 07:28:38 +0000 Subject: [PATCH 1/4] GSoC Phase 1: Enhance CI workflows and switch to Github Actions More details of the work of this phase could be checked at my wiki https://github.com/BoostGSoC20/ublas/wiki --- .appveyor.yml | 82 ----- .ci/install-clblas.sh | 3 + .ci/post_review.py | 221 ++++++++++++++ .ci/report_coverage.sh | 23 +- .clang-format | 394 +++++++++++++++++++++++++ .clang-tidy | 11 + .github/workflows/address_san.yml | 63 ++++ .github/workflows/apple_clang.yml | 67 +++++ .github/workflows/clangtidy_check.yml | 33 +++ .github/workflows/clangtidy_review.yml | 40 +++ .github/workflows/code_format.yml | 20 ++ .github/workflows/linux_clang.yml | 84 ++++++ .github/workflows/linux_gcc.yml | 93 ++++++ .github/workflows/thread_san.yml | 64 ++++ .github/workflows/ub_san.yml | 64 ++++ .github/workflows/windows_msvc.yml | 87 ++++++ .travis.yml | 108 ------- README.md | 59 +++- benchmarks/opencl/Jamfile | 1 + examples/tensor/.clang-tidy | 11 + examples/tensor/Jamfile | 4 +- test/Jamfile | 2 - test/opencl/Jamfile | 1 + test/tensor/Jamfile | 3 +- 24 files changed, 1312 insertions(+), 226 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .ci/post_review.py create mode 100644 .clang-format create mode 100644 .clang-tidy create mode 100644 .github/workflows/address_san.yml create mode 100644 .github/workflows/apple_clang.yml create mode 100644 .github/workflows/clangtidy_check.yml create mode 100644 .github/workflows/clangtidy_review.yml create mode 100644 .github/workflows/code_format.yml create mode 100644 .github/workflows/linux_clang.yml create mode 100644 .github/workflows/linux_gcc.yml create mode 100644 .github/workflows/thread_san.yml create mode 100644 .github/workflows/ub_san.yml create mode 100644 .github/workflows/windows_msvc.yml delete mode 100644 .travis.yml create mode 100644 examples/tensor/.clang-tidy diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 12bec8fce..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2018 Stefan Seefeld -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - -version: 1.0.{build}-{branch} - -shallow_clone: true - -branches: - only: - - master - - develop - - /feature\/.*/ - - expr_template - - framework - -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - TOOLSET: msvc-14.2 - CXXSTD: latest - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - TOOLSET: msvc-14.2 - CXXSTD: 17 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-14.0 - CXXSTD: 11 - -# cache: - # - c:\tools\vcpkg\installed\ - -install: - - cd "C:\Tools\vcpkg" - - git pull - - .\bootstrap-vcpkg.bat - - cd %appveyor_build_folder% - # Install OpenCL runtime (driver) for Intel / Xeon package - - appveyor DownloadFile "http://registrationcenter-download.intel.com/akdlm/irc_nas/9022/opencl_runtime_16.1.1_x64_setup.msi" - - start /wait msiexec /i opencl_runtime_16.1.1_x64_setup.msi /qn /l*v msiexec2.log - # FIXME: To be removed https://help.appveyor.com/discussions/problems/13000-cmake_toolchain_filevcpkgcmake-conflicts-with-cmake-native-findboostcmake" - - ps: 'Write-Host "Installing latest vcpkg.cmake module" -ForegroundColor Magenta' - - appveyor DownloadFile https://raw.githubusercontent.com/Microsoft/vcpkg/master/scripts/buildsystems/vcpkg.cmake -FileName "c:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake" - - set "TRIPLET=x64-windows" - - vcpkg --triplet %TRIPLET% install opencl clblas - - set PATH=C:\Tools\vcpkg\installed\%TRIPLET%\bin;%PATH% - - set VCPKG_I=C:\Tools\vcpkg\installed\%TRIPLET%\include - - set VCPKG_L=C:\Tools\vcpkg\installed\%TRIPLET%\lib - - set BOOST_BRANCH=develop - - if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master - - cd .. - - git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost-root - - cd boost-root - - git submodule update --init tools/build - - git submodule update --init libs/config - - git submodule update --init tools/boostdep - - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\numeric\ublas - - python tools/boostdep/depinst/depinst.py -I benchmarks numeric/ublas - - xcopy %APPVEYOR_BUILD_FOLDER%\opencl.jam %USERPROFILE% - - xcopy %APPVEYOR_BUILD_FOLDER%\clblas.jam %USERPROFILE% - - ps: | - # Creating %USERPROFILE%/user-config.jam file - @' - import os regex toolset ; - local toolset = [ regex.split [ os.environ TOOLSET ] "-" ] ; - local vcpkg_i = [ os.environ VCPKG_I ] ; - local vcpkg_l = [ os.environ VCPKG_L ] ; - using $(toolset[1]) : $(toolset[2-]:J="-") : ; - using opencl : : $(vcpkg_i) $(vcpkg_l) ; - using clblas : : $(vcpkg_i) $(vcpkg_l) ; - '@ | sc "$env:USERPROFILE/user-config.jam" - - cmd /c bootstrap - - b2 -j3 headers - -build: off - -test_script: - #- PATH=%ADDPATH%%PATH% - - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - - set ADDRMD=address-model=64 - - b2 -j3 libs/numeric/ublas/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% - - b2 -j3 libs/numeric/ublas/benchmarks toolset=%TOOLSET% %CXXSTD% %ADDRMD% - - b2 -j3 libs/numeric/ublas/examples/tensor toolset=%TOOLSET% %CXXSTD% %ADDRMD% diff --git a/.ci/install-clblas.sh b/.ci/install-clblas.sh index f8d9a6cc7..27994e87c 100755 --- a/.ci/install-clblas.sh +++ b/.ci/install-clblas.sh @@ -3,8 +3,11 @@ wget https://github.com/clMathLibraries/clBLAS/releases/download/v2.12/clBLAS-2.12.0-Linux-x64.tar.gz tar xvf clBLAS-2.12.0-Linux-x64.tar.gz if [ ${CLBLAS_PREFIX} ]; then + echo "Installing clBLAS-2.12.0" mkdir -p ${CLBLAS_PREFIX}/lib/ cp -r clBLAS-2.12.0-Linux-x64/include ${CLBLAS_PREFIX}/include cp -r clBLAS-2.12.0-Linux-x64/lib64/* ${CLBLAS_PREFIX}/lib/ cp -r clBLAS-2.12.0-Linux-x64/bin ${CLBLAS_PREFIX}/bin +else + echo "CLBLAS_PREFIX is not set. Skipping CLBLAS Installation" fi diff --git a/.ci/post_review.py b/.ci/post_review.py new file mode 100644 index 000000000..7f6f473d3 --- /dev/null +++ b/.ci/post_review.py @@ -0,0 +1,221 @@ +#! usr/bin/env python3 + +# Automatically create review from clang-tidy report +# Copyright (c) 2020 Ashar Khan +# Licensed under Boost Software License 1.0 + +import argparse +from github import Github +import unidiff +import os +import requests + + +def fetch_diff(repository, pr, token): + """ + Fetch the diff of PR from repository using Github Authentication token + """ + headers = { + "Accept": "application/vnd.github.v3.diff", + "Authorization": f"token {token}", + } + url = f"https://api.github.com/repos/{repository}/pulls/{pr}" + response = requests.get(url, headers=headers) + response.raise_for_status() + + return unidiff.PatchSet(response.text) + + +def parse_report_file(content): + """ + Parses clang-tidy stdout content to a list of tuple(relpath, line, comment), this tuple is called reports throughout the docs. + relpath: The relative path of source that generated clang-tidy warning or error + line: Line number in the above soure to which the error or warning belongs + comment: The actual clang-tidy error or warning for above line and source + """ + root_path = os.getcwd() + parsed_report = [] + n = len(content) + i = 0 + while (i < n): + if "error" in content[i] or "warning" in content[i]: + abs_file_path, line_number, _, severity, message = content[i].split( + ":", maxsplit=4) + relative_path = os.path.relpath(abs_file_path, root_path) + + k = 1 + body = "" + while i+k < n and not ("error" in content[i+k] or "warning" in content[i+k]): + body += "\n" + content[i + k].replace(abs_file_path, relative_path) + k += 1 + i += k + + message = message.strip().replace("'", "`") + body = body.strip() + + comment_text = f"""{message} +```cpp +{body} +``` +Reported as{severity} by clang-tidy. +""" + parsed_report.append((relative_path, line_number, comment_text)) + return parsed_report + + +def file_filter_report(reports, diff): + """ + Filter the reports so that it only contains the reports for files in diff that have changed or been added in the PR + """ + changed_files = [] + for file in diff: + changed_files.append(file.target_file[2:]) + + filtered_report = [] + for report in reports: + rel_path, line_number, comment_text = report + if rel_path in changed_files: + filtered_report.append(report) + + return filtered_report + + +def line_filter_report(reports, diff): + """ + Filter the reports so that it only contains the reports for lines in the diff that have been added. + """ + files_in_report = [i[0] for i in reports] + filtered_report = [] + + lookup = {} + for file in diff: + if file.target_file[2:] in files_in_report: + for hunk in file: + for line in hunk.target_lines(): + if line.is_added: + if file.target_file[2:] not in lookup: + lookup[file.target_file[2:]] = list() + lookup[file.target_file[2:]].append( + int(line.target_line_no)) + + for report in reports: + fileName, number, _ = report + number = int(number) + if number in lookup[fileName]: + filtered_report.append(report) + + return filtered_report + + +def line_to_position(reports, diff): + """ + The actual source file line number in report is different from what we need to send to github as review payload. + This function converts the clang-tidy generated error or warning line numbers to position in diff, + so that review can be made for position relevant to the PR. + """ + lookup = {} + for file in diff: + filename = file.target_file[2:] + lookup[filename] = {} + pos = 1 + for hunk in file: + for line in hunk: + if not line.is_removed: + lookup[filename][line.target_line_no] = pos + pos += 1 + pos += 1 + new_reports = [] + for report in reports: + x, y, z = report + new_reports.append((x, lookup[x][int(y)], z)) + + return new_reports + + +def comment_lgtm(pr_handle): + """ + Posts a LGTM (Looks good to me!) comment in the PR, if PR did not produced new clang-tidy warnings or errors. + """ + lgtm = 'This Pull request Passed all of clang-tidy tests. :+1:' + comments = pr_handle.get_issue_comments() + + for comment in comments: + if comment.body == lgtm: + print("Already posted LGTM!!") + return + + pr_handle.create_issue_comment(lgtm) + + +def post_review(reports, pr_handle): + """ + Posts the reports as review to the PR + """ + comments = pr_handle.get_review_comments() + for comment in comments: + target = (comment.path, comment.position, comment.body) + if target in reports: + reports.remove((comment.path, comment.position, comment.body)) + + if len(reports) == 0: + comment_lgtm(pr_handle) + else: + comments = [] + for report in reports: + comments.append( + {"path": report[0], "position": report[1], "body": report[2]}) + + review = { + "body": "Reports by clang tidy", + "event": "COMMENT", + "comments": comments, + } + + pr_handle.create_review(**review) + print("Review comments are on its way!") + + +def main(pathToClangReport, repository, pr, token): + """ + Psudo-Main function, that calls all above functions in order. + """ + f = open(pathToClangReport) + lines = f.read().splitlines() + f.close() + + reports = parse_report_file(lines) + diff = fetch_diff(repository, pr, token) + # Filter the report, So that only changed files are commented + reports = file_filter_report(reports, diff) + # Fileter the reports, So that only changed lines are commented + reports = line_filter_report(reports, diff) + + github = Github(token) + repo = github.get_repo(f"{repository}") + pr_handle = repo.get_pull(pr) + + if len(reports) == 0: + comment_lgtm(pr_handle) + else: + post_review(line_to_position(reports, diff), pr_handle) + + +if __name__ == "__main__": + """ + Parses command line arguments for the script and calls main function with the script. + """ + parser = argparse.ArgumentParser( + description="Create review from clang tidy file") + parser.add_argument( + "--path", help="Path to clang-tidy report file. This file can be" + "generated by redirecting stdout of clang-tidy to a file while running the check", required=True) + parser.add_argument( + "--repository", help="Pass repositor on Github with owner/repo format", required=True) + parser.add_argument( + "--pr", help="The repository's PR number to perform review", type=int, required=True) + parser.add_argument( + "--token", help="Github authentication token", required=True) + + args = parser.parse_args() + + main(args.path, args.repository, args.pr, args.token) diff --git a/.ci/report_coverage.sh b/.ci/report_coverage.sh index 0106329de..19ec243e6 100755 --- a/.ci/report_coverage.sh +++ b/.ci/report_coverage.sh @@ -1,19 +1,10 @@ #! /bin/bash -e -# Only collect and upload coverage reports from C++17 Builds -# This is required because Tensor Extension only runs with C++17 +sudo apt-get install lcov +lcov --rc lcov_branch_coverage=1 --directory $BOOST_ROOT --capture --output-file coverage.info -if [ $CXXSTD == '17' ] - then - # Capture all the coverge reports - lcov --rc lcov_branch_coverage=1 --directory $BOOST_ROOT --capture --output-file coverage.info - - # Remove all unwanted coverages libs. - # Boost.uBLAS depends uses many internal boost libs, we don't want them to be in coverage. - - lcov --rc lcov_branch_coverage=1 --extract coverage.info "*/boost/numeric/ublas/*" "*/libs/numeric/ublas/*" --output-file coverage.info - - lcov --rc lcov_branch_coverage=1 --list coverage.info -else - echo "Skipping Coverage Reporting as CXXSTD is 11" -fi +# Remove all unwanted coverages libs. +# Boost.uBLAS depends uses many internal boost libs, we don't want them to be in coverage. + +lcov --rc lcov_branch_coverage=1 --extract coverage.info "*/boost/numeric/ublas/tensor/*" "*/libs/numeric/ublas/tensor/*" --output-file coverage.info +lcov --rc lcov_branch_coverage=1 --list coverage.info diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..448ebcf4e --- /dev/null +++ b/.clang-format @@ -0,0 +1,394 @@ +--- +Language: Cpp +# BasedOnStyle: Microsoft +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +# someLongFunction(argument1, +# argument2); +# +AlignConsecutiveMacros: true +# #define SHORT_NAME 42 +# #define LONGER_NAME 0x007f +# #define EVEN_LONGER_NAME (2) +# +AlignConsecutiveAssignments: true +# int aaaa = 12; +# int b = 23; +# int ccc = 23; +# +AlignConsecutiveDeclarations: false +# +AlignEscapedNewlines: Left +# #define A \ +# int aaaa; \ +# int b; \ +# int dddddddddd; +# +AlignOperands: true +# int aaa = bbbbbbbbbbbbbbb + +# ccccccccccccccc; +# +AlignTrailingComments: true +# int a; // My comment a +# int b = 2; // comment b +# +AllowAllArgumentsOnNextLine: true +# callFunction( +# a, b, c, d); +# +AllowAllConstructorInitializersOnNextLine: true +# MyClass::MyClass() : +# member0(0), +# member1(2) {} +# +AllowAllParametersOfDeclarationOnNextLine: true +# void myFunction( +# int a, int b, int c, int d, int e); +# +AllowShortBlocksOnASingleLine: true +# if (a) { return; } +# +AllowShortCaseLabelsOnASingleLine: false +# switch (a) { +# case 1: x = 1; break; +# case 2: return; +# } +# +AllowShortFunctionsOnASingleLine: All +# class Foo { +# void f() { foo(); } +# }; +# void f() { bar(); } +# +AllowShortLambdasOnASingleLine: All +# auto lambda = [](int a) {} +# auto lambda2 = [](int a) { return a; }; +# +# Not found in clang 9.0.0 +# AllowShortIfStatementsOnASingleLine: All +# +AllowShortLoopsOnASingleLine: true +# while (true) continue; +# +# Depcrated according to clang 9.0.0 +# AlwaysBreakAfterDefinitionReturnType: None +# +AlwaysBreakAfterReturnType: None +# class A { +# int f() { return 0; }; +# }; +# int f(); +# int f() { return 1; } +# +AlwaysBreakBeforeMultilineStrings: true +# aaaa = +# "bbbb" +# "cccc"; +# +AlwaysBreakTemplateDeclarations: MultiLine +# template T foo() { +# } +# template +# T foo(int aaaaaaaaaaaaaaaaaaaaa, +# int bbbbbbbbbbbbbbbbbbbbb) { +# } +# +BinPackArguments: false +# void f() { +# f(aaaaaaaaaaaaaaaaaaaa, +# aaaaaaaaaaaaaaaaaaaa, +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); +# } +# +BinPackParameters: false +# void f(int aaaaaaaaaaaaaaaaaaaa, +# int aaaaaaaaaaaaaaaaaaaa, +# int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} +# +BraceWrapping: + AfterCaseLabel: false + AfterClass: false +# class foo +# { +# int x; +# }; + AfterControlStatement: false +# if (foo()) { +# } else { +# } +# for (int i = 0; i < 10; ++i) { +#} + AfterEnum: false +# enum X : int { B }; + AfterFunction: true +# void foo() +# { +# bar(); +# bar2(); +# } + AfterNamespace: true +# namespace +# { +# int foo(); +# int bar(); +# } + AfterObjCDeclaration: true + AfterStruct: true +# struct foo +# { +# int x; +# }; + AfterUnion: true +# union foo +# { +# int x; +# } + AfterExternBlock: true +# extern "C" +# { +# int foo(); +# } + BeforeCatch: true +# try { +# foo(); +# } +# catch () { +# } + BeforeElse: true +# if (foo()) { +# } +# else { +# } + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakBeforeBinaryOperators: None +# LooooooooooongType loooooooooooooooooooooongVariable = +# someLooooooooooooooooongFunction(); +# +# bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa == +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && +# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > +# ccccccccccccccccccccccccccccccccccccccccc; +# +BreakBeforeBraces: Stroustrup +# try { +# foo(); +# } +# catch () { +# } +# void foo() { bar(); } +# class foo { +# }; +# if (foo()) { +# } +# else { +# } +# +# enum X : int { A, B }; +# +# Not found in clang 9.0.0 +# BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeComma +# class Foo +# : Base1 +# , Base2 +# {}; +BreakBeforeTernaryOperators: true +# veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongDescription +# ? firstValue +# : SecondValueVeryVeryVeryVeryLong; +# +# Not found in clang 9.0.0 +# BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeComma +# Constructor() +# : initializer1() +# , initializer2() +# +# Not found in clang 9.0.0 +# BreakAfterJavaFieldAnnotations: false +# +BreakStringLiterals: true +ColumnLimit: 80 +# the column limit is based on GNU, Google and Mozilla coding style +# for 1080p two split windows can be shown side by side with font size 10 +# +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +# namespace Foo { +# namespace Bar { +# } +# } +# +ConstructorInitializerAllOnOneLineOrOnePerLine: false +# SomeClass::Constructor() +# : aaaaaaaa(aaaaaaaa), aaaaaaaa(aaaaaaaa), +# aaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa) { +# return 0; +# } +# +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +# int i = // VeryVeryVeryVeryVeryLongComment +# longFunction( // Again a long comment +# arg); +# +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +# namespace a { +# foo(); +# } // namespace a +# +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Regroup +# #include "b.h" into #include "a.h" +# #include "b.h" +# #include +# #include "a.h" #include +# +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: false +IndentPPDirectives: None +# #if FOO +# #if BAR +# #include +# #endif +# #endif +# +IndentWidth: 2 +IndentWrappedFunctionNames: false +# LoooooooooooooooooooooooooooooooooooooooongReturnType +# LoooooooooooooooooooooooooooooooongFunctionDeclaration(); +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +# if (foo) { +# bar(); +# } +# +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +# Zero of consecutive empty lines to keep. +# +NamespaceIndentation: None +# namespace out { +# int i; +# namespace in { +# int i; +# } +# } +# +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 1000 +PointerAlignment: Left +# int* a; +# +ReflowComments: true +# // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of +# // information +# /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of +# * information */ +# +SortIncludes: false +# #include "b.h" +# #include "a.h" +# +SortUsingDeclarations: false +# using std::cout; +# using std::cin; +# +SpaceAfterCStyleCast: false +# (int)i; +# +SpaceAfterLogicalNot: false +# !someExpression(); +# +SpaceAfterTemplateKeyword: true +# template void foo(); +# +SpaceBeforeAssignmentOperators: true +# int a = 5; +# a += 42; +# +SpaceBeforeCpp11BracedList: false +# Foo foo{ bar }; +# Foo{}; +# vector{ 1, 2, 3 }; +# new int[3]{ 1, 2, 3 }; +# +SpaceBeforeCtorInitializerColon: true +# Foo::Foo() : a(a) {} +# +SpaceBeforeInheritanceColon: true +# class Foo : Bar {} +# +SpaceBeforeParens: ControlStatements +# void f() { +# if (true) { +# f(); +# } +# } +# +SpaceBeforeRangeBasedForLoopColon: false +# for(auto v: values) {} +# +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 3 +# void f() { +# if (true) { // foo1 +# f(); // bar +# } // foo +# } +# +SpacesInAngles: false +# static_cast(arg); +# std::function fct; +# +SpacesInContainerLiterals: false +# var arr = [1, 2, 3]; +# f({a: 1, b: 2, c: 3}); +SpacesInCStyleCastParentheses: false +# x = (int32)y +# +SpacesInParentheses: false +# t f(Deleted &) & = delete; +# +SpacesInSquareBrackets: false +# int a[5]; +# +Standard: Cpp11 +# In Clang 10.0.0: Cpp11, Cpp14, Cpp17 and Cpp20 +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 2 +UseTab: Never +... + diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000..e17df9a0e --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,11 @@ +--- +Checks: '-*,modernize-*,cppcoreguidelines-*,openmp-*,bugprone-*,performance-*,portability-*,readability-*,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-uppercase-literal-suffix,-readability-braces-around-statements' +WarningsAsErrors: '-*,modernize-*,cppcoreguidelines-*,openmp-*,bugprone-*,performance-*,portability-*,readability-*,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-uppercase-literal-suffix,-readability-braces-around-statements' +HeaderFilterRegex: 'boost\/numeric\/ublas\/tensor\/.*' +AnalyzeTemporaryDtors: false +FormatStyle: file +User: ublas-developers +CheckOptions: + - key: modernize-use-nullptr.NullMacros + value: 'NULL' +... diff --git a/.github/workflows/address_san.yml b/.github/workflows/address_san.yml new file mode 100644 index 000000000..74d75000c --- /dev/null +++ b/.github/workflows/address_san.yml @@ -0,0 +1,63 @@ +name: Address Sanitizer +# Trigger on Push to the repository, regardless of the branch. +# For fine tune, You can add specific branches or tags. +on: [push, pull_request] + +jobs: + build: + name: "${{matrix.config.cxx}} -std=c++${{matrix.config.cxxstd}}" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + # If any compiler fails to compile, continue CI for next compiler in matrix instead of failing early + matrix: + config: + - {cc: gcc-9, cxx: g++-9, cxxstd: 2a, name: gcc} + - {cc: clang-9, cxx: clang++-9, cxxstd: 2a, name: clang} + steps: + - uses: actions/checkout@v2 + + - name: Prepare BOOST_ROOT + run: | + cd ${GITHUB_WORKSPACE} + cd .. + + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + + git submodule update --init --depth=1 --jobs 8 tools/build + git submodule update --init --depth=1 --jobs 8 libs/config + git submodule update --init --depth=1 --jobs 8 tools/boostdep + + mkdir -p libs/numeric/ + cp -rp ${GITHUB_WORKSPACE}/. libs/numeric/ublas + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + ./bootstrap.sh + ./b2 -j 8 headers + + echo ::set-env name=BOOST_ROOT::${PWD} + + - name: Prepare Build + run: | + echo $BOOST_ROOT + cd $BOOST_ROOT + echo "using ${{matrix.config.name}} : : ${{ matrix.config.cxx }} ;" >> ~/user-config.jam; + + - name: Test Benchmarks + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 benchmarks toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} + + - name: Test Tensor Examples + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 examples/tensor toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} cxxflags="-g -fsanitize=address -fno-omit-frame-pointer" linkflags="-fsanitize=address" + + - name: Test Tensor + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test/tensor toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} cxxflags="-g -fsanitize=address -fno-omit-frame-pointer" linkflags="-fsanitize=address" diff --git a/.github/workflows/apple_clang.yml b/.github/workflows/apple_clang.yml new file mode 100644 index 000000000..0e81f1569 --- /dev/null +++ b/.github/workflows/apple_clang.yml @@ -0,0 +1,67 @@ +name: Apple Clang + +on: [push, pull_request] + +jobs: + build: + name: "Darwin 11.0 -std=c++${{matrix.cxxstd}}" + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + cxxstd: [11, 17, 2a] + + steps: + - uses: actions/checkout@v2 + + - name: Prepare BOOST_ROOT + run: | + cd ${GITHUB_WORKSPACE} + cd .. + + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + + git submodule update --init --depth=1 --jobs 8 tools/build + git submodule update --init --depth=1 --jobs 8 libs/config + git submodule update --init --depth=1 --jobs 8 tools/boostdep + + mkdir -p libs/numeric/ + cp -rp ${GITHUB_WORKSPACE}/. libs/numeric/ublas + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + ./bootstrap.sh + ./b2 -j 8 headers + + echo ::set-env name=BOOST_ROOT::${PWD} + + - name: Prepare Build + run: | + echo $BOOST_ROOT + cd $BOOST_ROOT + + echo "using clang : : clang++ ;" >> ~/user-config.jam; + + - name: Test Benchmarks + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 benchmarks toolset=clang cxxstd=${{matrix.cxxstd}} + + - name: Test Tensor Examples + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 examples/tensor toolset=clang cxxstd=${{matrix.cxxstd}} + + - name: Test Tensor + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test/tensor toolset=clang cxxstd=${{matrix.cxxstd}} + + - name: Test uBLAS + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test toolset=clang cxxstd=${{matrix.cxxstd}} diff --git a/.github/workflows/clangtidy_check.yml b/.github/workflows/clangtidy_check.yml new file mode 100644 index 000000000..f9e79f290 --- /dev/null +++ b/.github/workflows/clangtidy_check.yml @@ -0,0 +1,33 @@ +name: Clang tidy checks + +on: [push] + +jobs: + check: + name: Clang tidy Check + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: "Install dependencies" + run: | + sudo apt-get install -y clang-10 clang-tidy-10 + + - name: "Install Boost from Source" + run: | + cd .. + git clone --depth 1 https://github.com/boostorg/boost.git --recursive --shallow-submodules + cd boost + ./bootstrap.sh + ./b2 headers + sudo cp -r -L boost /usr/include + rm -rf boost + + - name: "Run clang-tidy check" + run: | + clang-tidy-10 examples/tensor/*.cpp -- -Iinclude -std=c++17 > reports.txt + + - name: "Show clang tidy report" + if: always() + run: | + cat reports.txt diff --git a/.github/workflows/clangtidy_review.yml b/.github/workflows/clangtidy_review.yml new file mode 100644 index 000000000..786843c1d --- /dev/null +++ b/.github/workflows/clangtidy_review.yml @@ -0,0 +1,40 @@ +name: Clang tidy Review + +on: [pull_request] + +jobs: + check: + name: Clang tidy Review + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: "Install dependencies" + run: | + sudo apt-get install -y clang-10 clang-tidy-10 + + - name: "Install Boost from Source" + run: | + cd .. + git clone --depth 1 https://github.com/boostorg/boost.git --recursive --shallow-submodules + cd boost + ./bootstrap.sh + ./b2 headers + sudo cp -r -L boost /usr/include + rm -rf boost + + - uses: actions/setup-python@v2 + + - name: "Run clang-tidy check" + run: | + clang-tidy-10 examples/tensor/*.cpp -- -Iinclude -std=c++17 > reports.txt + + - name: "Post review comments" + if: always() + run: | + pip3 install 'unidiff~=0.6.0' --force-reinstall + pip3 install 'PyGithub~=1.51' --force-reinstall + pip3 install 'requests~=2.23' --force-reinstall + + python ./.ci/post_review.py --repository ${{ github.repository }} --token ${{ github.token}} --pr ${{ github.event.pull_request.number }} --path reports.txt + diff --git a/.github/workflows/code_format.yml b/.github/workflows/code_format.yml new file mode 100644 index 000000000..36de644d9 --- /dev/null +++ b/.github/workflows/code_format.yml @@ -0,0 +1,20 @@ +name: "Code Format" + +on: [push, pull_request] + +jobs: + format: + name: "Code Formatting Check" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Install Clang Format 10 + run: | + sudo apt-get install -y clang-format-10 + + - name: "Format Codes" + run: clang-format-10 -i examples/tensor/*.cpp test/tensor/*.cpp include/boost/numeric/ublas/tensor/*.hpp include/boost/numeric/ublas/tensor/*/*.hpp + + - name: Check diff + run: git diff --exit-code HEAD \ No newline at end of file diff --git a/.github/workflows/linux_clang.yml b/.github/workflows/linux_clang.yml new file mode 100644 index 000000000..8b8dc3ec5 --- /dev/null +++ b/.github/workflows/linux_clang.yml @@ -0,0 +1,84 @@ +name: Linux Clang Release +# Trigger on Push to the repository, regardless of the branch. +# For fine tune, You can add specific branches or tags. +on: [push, pull_request] + +jobs: + build: + name: "${{matrix.config.cxx}} -std=c++${{matrix.config.cxxstd}}" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + # If any compiler fails to compile, continue CI for next compiler in matrix instead of failing early + matrix: + config: + - { cc: clang-6.0, cxx: clang++-6.0, cxxstd: 11} + - { cc: clang-8, cxx: clang++-8, cxxstd: 11} + - { cc: clang-9, cxx: clang++-9, cxxstd: 11} + - { cc: clang-10, cxx: clang++-10, cxxstd: 11} + - { cc: clang-6.0, cxx: clang++-6.0, cxxstd: 17} + - { cc: clang-8, cxx: clang++-8, cxxstd: 17} + - { cc: clang-9, cxx: clang++-9, cxxstd: 17} + - { cc: clang-10, cxx: clang++-10, cxxstd: 17} + - { cc: clang-10, cxx: clang++-10, cxxstd: 2a} + + steps: + - uses: actions/checkout@v2 + + - name: Install Clang 10 + if: matrix.config.cxx == 'clang++-10' + run: | + sudo apt-get update + sudo apt-get install -y clang-10 + + - name: Prepare BOOST_ROOT + run: | + cd ${GITHUB_WORKSPACE} + cd .. + + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + + git submodule update --init --depth=1 --jobs 8 tools/build + git submodule update --init --depth=1 --jobs 8 libs/config + git submodule update --init --depth=1 --jobs 8 tools/boostdep + + mkdir -p libs/numeric/ + cp -rp ${GITHUB_WORKSPACE}/. libs/numeric/ublas + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + ./bootstrap.sh + ./b2 -j 8 headers + + echo ::set-env name=BOOST_ROOT::${PWD} + + - name: Prepare Build + run: | + echo $BOOST_ROOT + cd $BOOST_ROOT + + echo "using clang : : ${{ matrix.config.cxx }} ;" >> ~/user-config.jam; + + - name: Test Benchmarks + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 benchmarks toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" + + - name: Test Tensor Examples + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 examples/tensor toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" + + - name: Test Tensor + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test/tensor toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" + + - name: Test uBLAS + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" diff --git a/.github/workflows/linux_gcc.yml b/.github/workflows/linux_gcc.yml new file mode 100644 index 000000000..e4fa60658 --- /dev/null +++ b/.github/workflows/linux_gcc.yml @@ -0,0 +1,93 @@ +name: Linux GCC Debug +# Trigger on Push to the repository, regardless of the branch. +# For fine tune, You can add specific branches or tags. +on: [push, pull_request] + +jobs: + build: + name: "${{matrix.config.cxx}} -std=c++${{matrix.config.cxxstd}}" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + # If any compiler fails to compile, continue CI for next compiler in matrix instead of failing early + matrix: + config: + - {cc: gcc-7, cxx: g++-7, cxxstd: 11} + - {cc: gcc-8, cxx: g++-8, cxxstd: 11} + - {cc: gcc-9, cxx: g++-9, cxxstd: 11} + - {cc: gcc-10, cxx: g++-10, cxxstd: 11} + - {cc: gcc-7, cxx: g++-7, cxxstd: 17} + - {cc: gcc-8, cxx: g++-8, cxxstd: 17} + - {cc: gcc-9, cxx: g++-9, cxxstd: 17} + - {cc: gcc-10, cxx: g++-10, cxxstd: 17} + - {cc: gcc-10, cxx: g++-10, cxxstd: 2a} + steps: + - uses: actions/checkout@v2 + + - name: Install GCC-10 + if: matrix.config.cxx == 'g++-10' + run: | + sudo apt update + sudo apt-get install -y g++-10 + + - name: Prepare BOOST_ROOT + run: | + cd ${GITHUB_WORKSPACE} + cd .. + + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + + git submodule update --init --depth=1 --jobs 8 tools/build + git submodule update --init --depth=1 --jobs 8 libs/config + git submodule update --init --depth=1 --jobs 8 tools/boostdep + + mkdir -p libs/numeric/ + cp -rp ${GITHUB_WORKSPACE}/. libs/numeric/ublas + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + ./bootstrap.sh + ./b2 -j 8 headers + + echo ::set-env name=BOOST_ROOT::${PWD} + + - name: Prepare Build + run: | + echo $BOOST_ROOT + cd $BOOST_ROOT + + echo "using gcc : : ${{ matrix.config.cxx }} ;" >> ~/user-config.jam; + + - name: Test Benchmarks + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 benchmarks toolset=gcc cxxstd=${{matrix.config.cxxstd}} + + - name: Test Tensor Examples + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 examples/tensor toolset=gcc cxxstd=${{matrix.config.cxxstd}} cxxflags="-O0" + + - name: Test Tensor + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test/tensor toolset=gcc cxxstd=${{matrix.config.cxxstd}} cxxflags="-O0 -g --coverage" linkflags="--coverage" + + - name: Test uBLAS + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test toolset=gcc cxxstd=${{matrix.config.cxxstd}} cxxflags="-O0" + + - name: Report Code coverage + if: matrix.config.cxxstd == '17' && matrix.config.cxx == 'g++-9' + run: | + ${GITHUB_WORKSPACE}/.ci/report_coverage.sh + + curl -s https://codecov.io/bash > cov.sh + chmod +x cov.sh + ./cov.sh -f coverage.info || echo "Codecov did not collect coverage reports" + diff --git a/.github/workflows/thread_san.yml b/.github/workflows/thread_san.yml new file mode 100644 index 000000000..9b224f3d7 --- /dev/null +++ b/.github/workflows/thread_san.yml @@ -0,0 +1,64 @@ +name: Thread Sanitizer +# Trigger on Push to the repository, regardless of the branch. +# For fine tune, You can add specific branches or tags. +on: [push, pull_request] + +jobs: + build: + name: "${{matrix.config.cxx}} -std=c++${{matrix.config.cxxstd}}" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + # If any compiler fails to compile, continue CI for next compiler in matrix instead of failing early + matrix: + config: + - {cc: gcc-9, cxx: g++-9, cxxstd: 2a, name: gcc} + - {cc: clang-9, cxx: clang++-9, cxxstd: 2a, name: clang} + steps: + - uses: actions/checkout@v2 + + - name: Prepare BOOST_ROOT + run: | + cd ${GITHUB_WORKSPACE} + cd .. + + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + + git submodule update --init --depth=1 --jobs 8 tools/build + git submodule update --init --depth=1 --jobs 8 libs/config + git submodule update --init --depth=1 --jobs 8 tools/boostdep + + mkdir -p libs/numeric/ + cp -rp ${GITHUB_WORKSPACE}/. libs/numeric/ublas + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + ./bootstrap.sh + ./b2 -j 8 headers + + echo ::set-env name=BOOST_ROOT::${PWD} + + - name: Prepare Build + run: | + echo $BOOST_ROOT + cd $BOOST_ROOT + + echo "using ${{matrix.config.name}} : : ${{ matrix.config.cxx }} ;" >> ~/user-config.jam; + + - name: Test Benchmarks + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 benchmarks toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} + + - name: Test Tensor Examples + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 examples/tensor toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} cxxflags="-g -fsanitize=thread -O2" linkflags="-fsanitize=thread" + + - name: Test Tensor + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test/tensor toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} cxxflags="-g -fsanitize=thread -O2" linkflags="-fsanitize=thread" diff --git a/.github/workflows/ub_san.yml b/.github/workflows/ub_san.yml new file mode 100644 index 000000000..e687aa752 --- /dev/null +++ b/.github/workflows/ub_san.yml @@ -0,0 +1,64 @@ +name: Undefined Behaviour Sanitizer +# Trigger on Push to the repository, regardless of the branch. +# For fine tune, You can add specific branches or tags. +on: [push, pull_request] + +jobs: + build: + name: "${{matrix.config.cxx}} -std=c++${{matrix.config.cxxstd}}" + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + # If any compiler fails to compile, continue CI for next compiler in matrix instead of failing early + matrix: + config: + - {cc: gcc-9, cxx: g++-9, cxxstd: 2a, name: gcc} + - {cc: clang-9, cxx: clang++-9, cxxstd: 2a, name: clang} + steps: + - uses: actions/checkout@v2 + + - name: Prepare BOOST_ROOT + run: | + cd ${GITHUB_WORKSPACE} + cd .. + + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + + git submodule update --init --depth=1 --jobs 8 tools/build + git submodule update --init --depth=1 --jobs 8 libs/config + git submodule update --init --depth=1 --jobs 8 tools/boostdep + + mkdir -p libs/numeric/ + cp -rp ${GITHUB_WORKSPACE}/. libs/numeric/ublas + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + ./bootstrap.sh + ./b2 -j 8 headers + + echo ::set-env name=BOOST_ROOT::${PWD} + + - name: Prepare Build + run: | + echo $BOOST_ROOT + cd $BOOST_ROOT + + echo "using ${{matrix.config.name}} : : ${{ matrix.config.cxx }} ;" >> ~/user-config.jam; + + - name: Test Benchmarks + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 benchmarks toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} + + - name: Test Tensor Examples + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 examples/tensor toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} cxxflags="-g -fsanitize=undefined" linkflags="-fsanitize=undefined" + + - name: Test Tensor + run: | + cd $BOOST_ROOT + cd libs/numeric/ublas + $BOOST_ROOT/b2 -j 4 test/tensor toolset=${{matrix.config.name}} cxxstd=${{matrix.config.cxxstd}} cxxflags="-g -fsanitize=undefined" linkflags="-fsanitize=undefined" diff --git a/.github/workflows/windows_msvc.yml b/.github/workflows/windows_msvc.yml new file mode 100644 index 000000000..888cabade --- /dev/null +++ b/.github/workflows/windows_msvc.yml @@ -0,0 +1,87 @@ +name: "Windows MSVC" +on: [push, pull_request] + +jobs: + build: + name: "${{matrix.config.version}} -std=c++${{matrix.config.cxxstd}}" + runs-on: ${{matrix.config.os}} + strategy: + fail-fast: false + matrix: + config: + - {os: windows-2016, toolset: msvc, version: 14.16, cxxstd: 11, env: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} + - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: 11, env: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} + - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: 17, env: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} + - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: latest, env: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} + + steps: + - uses: actions/checkout@v2 + + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.2.0 + with: + toolset: ${{matrix.config.version}} + + - name: Setup BOOST_ROOT + shell: cmd + run: | + cd %GITHUB_WORKSPACE% + cd .. + git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + git submodule update --init --depth=1 tools/build + git submodule update --init --depth=1 libs/config + git submodule update --init --depth=1 tools/boostdep + + xcopy /s /e /q %GITHUB_WORKSPACE% libs\numeric\ublas + + python tools/boostdep/depinst/depinst.py -g " --depth=1" -I benchmarks numeric/ublas + + echo ::set-env name=BOOST_ROOT::%cd% + echo ::set-env name=TOOLSET::${{matrix.config.toolset}}-${{matrix.config.version}} + + - name: Prepare BOOST_ROOT + shell: powershell + run: | + echo $env:TOOLSET + # Creating %USERPROFILE%/user-config.jam file + @' + import os regex toolset ; + local toolset = [ regex.split [ os.environ TOOLSET ] "-" ] ; + using $(toolset[1]) : $(toolset[2-]:J="-") : ; + '@ | sc "$env:USERPROFILE/user-config.jam" + + - name: Bootstrap BOOST_ROOT + shell: cmd + run: | + cd %BOOST_ROOT% + cmd /c bootstrap + b2 -j8 headers + + - name: Test Benchmarks + shell: cmd + run: | + cd %BOOST_ROOT% + cd libs\numeric\ublas + %BOOST_ROOT%\b2 -j 4 benchmarks toolset=%TOOLSET% cxxstd=${{matrix.config.cxxstd}} address-model=64 + + - name: Test Tensor Examples + shell: cmd + run: | + cd %BOOST_ROOT% + cd libs\numeric\ublas + %BOOST_ROOT%\b2 -j 4 examples/tensor toolset=%TOOLSET% cxxstd=${{matrix.config.cxxstd}} address-model=64 + + - name: Test Tensor + shell: cmd + run: | + cd %BOOST_ROOT% + cd libs\numeric\ublas + %BOOST_ROOT%\b2 -j 4 test/tensor toolset=%TOOLSET% cxxstd=${{matrix.config.cxxstd}} address-model=64 + + - name: Test uBLAS + shell: cmd + run: | + cd %BOOST_ROOT% + cd libs\numeric\ublas + %BOOST_ROOT%\b2 -j 4 test toolset=%TOOLSET% cxxstd=${{matrix.config.cxxstd}} address-model=64 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ff6bf3a47..000000000 --- a/.travis.yml +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2018 Stefan Seefeld -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - - -language: cpp - -dist: bionic - -sudo: required - -branches: - only: - - master - - develop - - doc - - ci - - expr_template - - framework - -# env: specifies additional global variables to define per row in build matrix -env: - global: - - CLBLAS_PREFIX=${TRAVIS_BUILD_DIR}/CLBLAS/ - - PATH=${CLBLAS_PREFIX}/bin:$PATH - - LD_LIBRARY_PATH=${CLBLAS_PREFIX}/lib:$LD_LIBRARY_PATH - -matrix: - include: - - os: linux - env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=11 - - os: linux - env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=17 - - os: linux - env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=2a - - os: linux - env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=17 - - os: linux - env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=2a - -addons: - apt: - sources: - - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - g++-7 - - g++-9 - - clang-7 - - clang-10 - - libopenblas-base - - rpm2cpio - - cpio - - clinfo - - opencl-headers - - ocl-icd-opencl-dev - - lcov - -before_install: - - if [ ${TRAVIS_OS_NAME} == "linux" ]; then .ci/install-ocl-ubuntu.sh; fi - - .ci/install-clblas.sh - - cmake --version; - - ${CC} --version; - - ${CXX} --version; - -install: - - cd .. - - git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root - - cd boost-root - - git submodule update --init --jobs 8 tools/build - - git submodule update --init --jobs 8 libs/config - - git submodule update --init --jobs 8 tools/boostdep - - mkdir -p libs/numeric/ - - cp -rp $TRAVIS_BUILD_DIR/. libs/numeric/ublas - - python tools/boostdep/depinst/depinst.py -I benchmarks numeric/ublas - - ./bootstrap.sh - - ./b2 -j 8 headers - - export BOOST_ROOT="`pwd`" - -# Use before_script: to run configure steps -before_script: - - -# use script: to execute build steps -script: - - |- - echo "using $TOOLSET : : $COMPILER ;" >> ~/user-config.jam; - echo "using clblas : : ${CLBLAS_PREFIX}/include ${CLBLAS_PREFIX}/lib ;" >> ~/user-config.jam; - cp $TRAVIS_BUILD_DIR/opencl.jam ~/ - cp $TRAVIS_BUILD_DIR/clblas.jam ~/ - - cd libs/numeric/ublas - - travis_wait 120 sleep infinity & $BOOST_ROOT/b2 -j 8 test/tensor toolset=$TOOLSET cxxstd=$CXXSTD - - $BOOST_ROOT/b2 -j 8 benchmarks toolset=$TOOLSET cxxstd=$CXXSTD - - $BOOST_ROOT/b2 -j 8 examples/tensor toolset=$TOOLSET cxxstd=$CXXSTD - -after_success: - - .ci/report_coverage.sh - # Uploading to CodeCov - # '-f' specifies file(s) to use and disables manual coverage gathering and file search which has already been done above - - curl -s https://codecov.io/bash > cov.sh - - chmod +x cov.sh - - ./cov.sh -f coverage.info || echo "Codecov did not collect coverage reports" - - -notifications: - email: - on_success: always diff --git a/README.md b/README.md index c435b8ca9..5ea5e1a1a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Boost Linear and Multilinear Algebra Library ===== + [![Language](https://img.shields.io/badge/C%2B%2B-11-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) [![License](https://img.shields.io/badge/license-BSL-blue.svg)](https://opensource.org/licenses/BSL-1.0) [![Documentation](https://img.shields.io/badge/ublas-documentation-blue.svg)](https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/index.html) @@ -19,29 +20,57 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org ## Properties * Header-only -* Tensor extension requires C++17 compatible compiler, compiles with - * gcc 7.3.0 - * clang 6.0 - * msvc 14.1 +* Tensor extension requires C++17 compatible compiler * Unit-tests require Boost.Test ## Build Status -Branch | Travis | Appveyor | Regression | codecov.io | Docs | -:-----: | ------ | --------- | ----------- | ----------- | ----- | - [`master`](https://github.com/boostorg/ublas/tree/master) | [![Build Status](https://travis-ci.org/boostorg/ublas.svg?branch=master)](https://travis-ci.org/boostorg/ublas) | [![Build status](https://ci.appveyor.com/api/projects/status/ctu3wnfowa627ful/branch/master?svg=true)](https://ci.appveyor.com/project/stefanseefeld/ublas/branch/master) | [![ublas](https://img.shields.io/badge/ublas-master-blue.svg)](https://www.boost.org/development/tests/master/developer/numeric-ublas.html) | [![codecov](https://codecov.io/gh/boostorg/ublas/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/ublas/branch/master) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/release/libs/numeric) | - [`develop`](https://github.com/boostorg/ublas/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/ublas.svg?branch=develop)](https://travis-ci.org/boostorg/ublas) | [![Build status](https://ci.appveyor.com/api/projects/status/ctu3wnfowa627ful/branch/develop?svg=true)](https://ci.appveyor.com/project/stefanseefeld/ublas/branch/develop) | [![ublas](https://img.shields.io/badge/ublas-develop-blue.svg)](https://www.boost.org/development/tests/develop/developer/numeric-ublas.html) | [![codecov](https://codecov.io/gh/boostorg/ublas/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/ublas/branch/develop) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/release/libs/numeric) | + +#### Build & Test + +| Operating System | Compiler | [`master`](https://github.com/boostorg/ublas/tree/master) | [`develop`](https://github.com/boostorg/ublas/tree/develop) | +| :-------------------------: | :-----------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | +| Linux (Ubuntu 20.04 x86_64) | gcc-{7, 8, 9, 10} | [![Linux GCC Debug](https://github.com/boostorg/ublas/workflows/Linux%20GCC%20Debug/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Linux+GCC%22+branch%3Amaster) | [![Linux GCC Debug](https://github.com/boostorg/ublas/workflows/Linux%20GCC%20Debug/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Linux+GCC%22+branch%3Adevelop) | +| Linux (Ubuntu 20.04 x86_64) | clang-{6, 8, 9, 10} | [![Linux Clang Release](https://github.com/boostorg/ublas/workflows/Linux%20Clang%20Release/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Linux+Clang%22+branch%3Amaster) | [![Linux Clang Release](https://github.com/boostorg/ublas/workflows/Linux%20Clang%20Release/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Linux+Clang%22+branch%3Adevelop) | +| Windows 10 (x86_64) | msvc-{14.16, 14.26} | [![Windows MSVC](https://github.com/boostorg/ublas/workflows/Windows%20MSVC/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Windows+MSVC%22+branch%3Amaster) | [![Windows MSVC](https://github.com/boostorg/ublas/workflows/Windows%20MSVC/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Windows+MSVC%22+branch%3Adevelop) | +| MacOS Catalina (x86_64) | clang-11 | [![Apple Clang](https://github.com/boostorg/ublas/workflows/Apple%20Clang/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Apple+Clang%22+branch%3Amaster) | [![Apple Clang](https://github.com/boostorg/ublas/workflows/Apple%20Clang/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Apple+Clang%22+branch%3Adevelop) | + +#### Additional Checks + +| Checks | [`master`](https://github.com/boostorg/ublas/tree/master) | [`develop`](https://github.com/boostorg/ublas/tree/develop) | +| :-----------: | :----------------------------------------------------------: | :----------------------------------------------------------: | +| UB Sanitizer | [![Undefined Behaviour Sanitizer](https://github.com/boostorg/ublas/workflows/Undefined%20Behaviour%20Sanitizer/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Undefined+Behaviour+Sanitizer%22+branch%3Amaster) | [![Undefined Behaviour Sanitizer](https://github.com/boostorg/ublas/workflows/Undefined%20Behaviour%20Sanitizer/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Undefined+Behaviour+Sanitizer%22+branch%3Adevelop) | +| TH Sanitizer | [![Thread Sanitizer](https://github.com/boostorg/ublas/workflows/Thread%20Sanitizer/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Thread+Sanitizer%22+branch%3Amaster) | [![Thread Sanitizer](https://github.com/boostorg/ublas/workflows/Thread%20Sanitizer/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Thread+Sanitizer%22+branch%3Adevelop) | +| ADD Sanitizer | [![Address Sanitizer](https://github.com/boostorg/ublas/workflows/Address%20Sanitizer/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Address+Sanitizer%22+branch%3Amaster) | [![Address Sanitizer](https://github.com/boostorg/ublas/workflows/Address%20Sanitizer/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Address+Sanitizer%22+branch%3Adevelop) | +| Codecov | [![codecov](https://codecov.io/gh/boostorg/ublas/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/ublas/branch/master) | [![codecov](https://codecov.io/gh/boostorg/ublas/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/ublas/branch/develop) | +| Clang-Format | [![Code Format](https://github.com/boostorg/ublas/workflows/Code%20Format/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Code+Format%22+branch%3Amaster) | [![Code Format](https://github.com/boostorg/ublas/workflows/Code%20Format/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Code+Format%22+branch%3Adevelop) | +| Clang-Tidy | [![Clang tidy checks](https://github.com/boostorg/ublas/workflows/Clang%20tidy%20checks/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Clang+tidy+checks%22+branch%3Amaster) | [![Clang tidy checks](https://github.com/boostorg/ublas/workflows/Clang%20tidy%20checks/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Clang+tidy+checks%22+branch%3Adevelop) | + +#### Build Information + +| OS | Toolchain | Compiler Flags | +| :----------------: | :-------------: | :-----------------------------------------------: | +| Linux Ubuntu 20.04 | GCC | `-O0` | +| Linux Ubuntu 20.04 | Clang | `-O3` | +| Windows 10 | MSVC | No Special Flags | +| MacOS Catalina | Clang | No Special Flags | +| UB Sanitizer | GCC and Clang | `"-g -fsanitize=undefined"` | +| TH Sanitizer | GCC and Clang | `"-g -fsanitize=thread -O2"` | +| ADD Sanitizer | GCC and Clang | `"-g -fsanitize=address -fno-omit-frame-pointer"` | +| Clang Tidy | Clang-Tidy-10 | [Configuration File](.clang-tidy) | +| Clang Format | Clang-Format-10 | [Configuration File](.clang-format) | + ## Directories -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `examples` | example files | -| `include` | headers | -| `test` | unit tests | -| `benchmarks`| timing and benchmarking | +| Name | Purpose | +| ------------ | ----------------------- | +| `doc` | documentation | +| `examples` | example files | +| `include` | headers | +| `test` | unit tests | +| `benchmarks` | timing and benchmarking | ## More information diff --git a/benchmarks/opencl/Jamfile b/benchmarks/opencl/Jamfile index 670ec66b8..282d00711 100644 --- a/benchmarks/opencl/Jamfile +++ b/benchmarks/opencl/Jamfile @@ -17,6 +17,7 @@ project boost/ublas/benchmarks/opencl : requirements /boost/program_options//boost_program_options gcc:-Wno-ignored-attributes + clang:-Wno-ignored-attributes [ ac.check-library /clblas//clblas : /clblas//clblas /opencl//opencl : no ] ; diff --git a/examples/tensor/.clang-tidy b/examples/tensor/.clang-tidy new file mode 100644 index 000000000..5b4892c35 --- /dev/null +++ b/examples/tensor/.clang-tidy @@ -0,0 +1,11 @@ +--- +Checks: '-*,modernize-*,cppcoreguidelines-*,openmp-*,bugprone-*,performance-*,portability-*,readability-*,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-uppercase-literal-suffix,-readability-braces-around-statements,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers' +WarningsAsErrors: '-*,modernize-*,cppcoreguidelines-*,openmp-*,bugprone-*,performance-*,portability-*,readability-*,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-uppercase-literal-suffix,-readability-braces-around-statements,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers' +HeaderFilterRegex: 'boost\/numeric\/ublas\/tensor\/.*' +AnalyzeTemporaryDtors: false +FormatStyle: file +User: ublas-developers +CheckOptions: + - key: modernize-use-nullptr.NullMacros + value: 'NULL' +... diff --git a/examples/tensor/Jamfile b/examples/tensor/Jamfile index 25e5f415f..5e333dcad 100644 --- a/examples/tensor/Jamfile +++ b/examples/tensor/Jamfile @@ -14,8 +14,8 @@ project boost-ublas-tensor-example 11:no BOOST_UBLAS_NO_EXCEPTIONS vacpp:"BOOST_UBLAS_NO_ELEMENT_PROXIES" - gcc:"-Wall -pedantic -Wextra -std=c++17" - gcc:"-Wno-unknown-pragmas" + gcc:"-Wall -pedantic -Wextra -Wno-unknown-pragmas" + clang:"-Wall -pedantic -Wextra -Wno-unknown-pragmas" msvc:"/W4" # == all ; diff --git a/test/Jamfile b/test/Jamfile index 26b67b045..f1e100f94 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -254,5 +254,3 @@ test-suite numeric/uBLAS ] ; -build-project opencl ; -build-project tensor ; diff --git a/test/opencl/Jamfile b/test/opencl/Jamfile index 51c74675e..cc8679223 100644 --- a/test/opencl/Jamfile +++ b/test/opencl/Jamfile @@ -16,6 +16,7 @@ using clblas ; project boost/ublas/test/opencl : requirements gcc:-Wno-ignored-attributes + clang:-Wno-ignored-attributes [ ac.check-library /clblas//clblas : /clblas//clblas /opencl//opencl : no ] ; diff --git a/test/tensor/Jamfile b/test/tensor/Jamfile index 3ce59e748..8264a6bc1 100644 --- a/test/tensor/Jamfile +++ b/test/tensor/Jamfile @@ -15,7 +15,8 @@ project boost/ublas/test/tensor : requirements # these tests require C++17 11:no - gcc:"-Wall -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-but-set-variable -O0 --coverage -g" --coverage + gcc:"-Wall -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-but-set-variable" + clang:"-Wall -Wno-unknown-pragmas -Wno-sign-compare" ; alias unit_test_framework From b19cd5cb1dc2493c741733ec2b70666db8d8f16e Mon Sep 17 00:00:00 2001 From: Ashar Khan Date: Sat, 4 Jul 2020 11:37:21 +0530 Subject: [PATCH 2/4] Tensor tests use Github Actions Old uBLAS will only use Travis and Appveyor from old legacy CI while Tensor is now build using modern Github Action on wide array of compiler and standards and codes. --- .appveyor.yml | 74 ++++++++++++++++++++++++ .github/workflows/apple_clang.yml | 6 -- .github/workflows/linux_clang.yml | 8 +-- .github/workflows/linux_gcc.yml | 6 -- .github/workflows/windows_msvc.yml | 8 +-- .travis.yml | 90 ++++++++++++++++++++++++++++++ README.md | 11 +++- 7 files changed, 174 insertions(+), 29 deletions(-) create mode 100644 .appveyor.yml create mode 100644 .travis.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..2b2d8fd53 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,74 @@ +# Copyright 2018 Stefan Seefeld +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +version: 1.0.{build}-{branch} + +shallow_clone: true + +branches: + only: + - master + - develop + - /feature\/.*/ + +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + TOOLSET: msvc-14.2 + CXXSTD: latest + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + TOOLSET: msvc-14.2 + CXXSTD: 17 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + TOOLSET: msvc-14.0 + CXXSTD: 11 + +install: + - cd "C:\Tools\vcpkg" + - git pull + - .\bootstrap-vcpkg.bat + - cd %appveyor_build_folder% + # Install OpenCL runtime (driver) for Intel / Xeon package + - appveyor DownloadFile "http://registrationcenter-download.intel.com/akdlm/irc_nas/9022/opencl_runtime_16.1.1_x64_setup.msi" + - start /wait msiexec /i opencl_runtime_16.1.1_x64_setup.msi /qn /l*v msiexec2.log + # FIXME: To be removed https://help.appveyor.com/discussions/problems/13000-cmake_toolchain_filevcpkgcmake-conflicts-with-cmake-native-findboostcmake" + - ps: 'Write-Host "Installing latest vcpkg.cmake module" -ForegroundColor Magenta' + - appveyor DownloadFile https://raw.githubusercontent.com/Microsoft/vcpkg/master/scripts/buildsystems/vcpkg.cmake -FileName "c:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake" + - set "TRIPLET=x64-windows" + - vcpkg --triplet %TRIPLET% install opencl clblas + - set PATH=C:\Tools\vcpkg\installed\%TRIPLET%\bin;%PATH% + - set VCPKG_I=C:\Tools\vcpkg\installed\%TRIPLET%\include + - set VCPKG_L=C:\Tools\vcpkg\installed\%TRIPLET%\lib + - set BOOST_BRANCH=develop + - if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master + - cd .. + - git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost-root + - cd boost-root + - git submodule update --init tools/build + - git submodule update --init libs/config + - git submodule update --init tools/boostdep + - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\numeric\ublas + - python tools/boostdep/depinst/depinst.py -I benchmarks numeric/ublas + - xcopy %APPVEYOR_BUILD_FOLDER%\opencl.jam %USERPROFILE% + - xcopy %APPVEYOR_BUILD_FOLDER%\clblas.jam %USERPROFILE% + - ps: | + # Creating %USERPROFILE%/user-config.jam file + @' + import os regex toolset ; + local toolset = [ regex.split [ os.environ TOOLSET ] "-" ] ; + local vcpkg_i = [ os.environ VCPKG_I ] ; + local vcpkg_l = [ os.environ VCPKG_L ] ; + using $(toolset[1]) : $(toolset[2-]:J="-") : ; + using opencl : : $(vcpkg_i) $(vcpkg_l) ; + using clblas : : $(vcpkg_i) $(vcpkg_l) ; + '@ | sc "$env:USERPROFILE/user-config.jam" + - cmd /c bootstrap + - b2 -j3 headers + +build: off + +test_script: + - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% + - set ADDRMD=address-model=64 + - b2 -j3 libs/numeric/ublas/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% \ No newline at end of file diff --git a/.github/workflows/apple_clang.yml b/.github/workflows/apple_clang.yml index 0e81f1569..7136c8af0 100644 --- a/.github/workflows/apple_clang.yml +++ b/.github/workflows/apple_clang.yml @@ -59,9 +59,3 @@ jobs: cd $BOOST_ROOT cd libs/numeric/ublas $BOOST_ROOT/b2 -j 4 test/tensor toolset=clang cxxstd=${{matrix.cxxstd}} - - - name: Test uBLAS - run: | - cd $BOOST_ROOT - cd libs/numeric/ublas - $BOOST_ROOT/b2 -j 4 test toolset=clang cxxstd=${{matrix.cxxstd}} diff --git a/.github/workflows/linux_clang.yml b/.github/workflows/linux_clang.yml index 8b8dc3ec5..fe3b16322 100644 --- a/.github/workflows/linux_clang.yml +++ b/.github/workflows/linux_clang.yml @@ -75,10 +75,4 @@ jobs: run: | cd $BOOST_ROOT cd libs/numeric/ublas - $BOOST_ROOT/b2 -j 4 test/tensor toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" - - - name: Test uBLAS - run: | - cd $BOOST_ROOT - cd libs/numeric/ublas - $BOOST_ROOT/b2 -j 4 test toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" + $BOOST_ROOT/b2 -j 4 test/tensor toolset=clang cxxstd=${{matrix.config.cxxstd}} cxxflags="-O3" \ No newline at end of file diff --git a/.github/workflows/linux_gcc.yml b/.github/workflows/linux_gcc.yml index e4fa60658..589041984 100644 --- a/.github/workflows/linux_gcc.yml +++ b/.github/workflows/linux_gcc.yml @@ -76,12 +76,6 @@ jobs: cd libs/numeric/ublas $BOOST_ROOT/b2 -j 4 test/tensor toolset=gcc cxxstd=${{matrix.config.cxxstd}} cxxflags="-O0 -g --coverage" linkflags="--coverage" - - name: Test uBLAS - run: | - cd $BOOST_ROOT - cd libs/numeric/ublas - $BOOST_ROOT/b2 -j 4 test toolset=gcc cxxstd=${{matrix.config.cxxstd}} cxxflags="-O0" - - name: Report Code coverage if: matrix.config.cxxstd == '17' && matrix.config.cxx == 'g++-9' run: | diff --git a/.github/workflows/windows_msvc.yml b/.github/workflows/windows_msvc.yml index 888cabade..c566c260e 100644 --- a/.github/workflows/windows_msvc.yml +++ b/.github/workflows/windows_msvc.yml @@ -78,10 +78,4 @@ jobs: cd %BOOST_ROOT% cd libs\numeric\ublas %BOOST_ROOT%\b2 -j 4 test/tensor toolset=%TOOLSET% cxxstd=${{matrix.config.cxxstd}} address-model=64 - - - name: Test uBLAS - shell: cmd - run: | - cd %BOOST_ROOT% - cd libs\numeric\ublas - %BOOST_ROOT%\b2 -j 4 test toolset=%TOOLSET% cxxstd=${{matrix.config.cxxstd}} address-model=64 + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..f4578d1b4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,90 @@ +# Copyright 2018 Stefan Seefeld +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + + +language: cpp + +dist: bionic + +sudo: required + +branches: + only: + - master + - develop + - doc + - ci + +# env: specifies additional global variables to define per row in build matrix +env: + global: + - CLBLAS_PREFIX=${TRAVIS_BUILD_DIR}/CLBLAS/ + - PATH=${CLBLAS_PREFIX}/bin:$PATH + - LD_LIBRARY_PATH=${CLBLAS_PREFIX}/lib:$LD_LIBRARY_PATH + +matrix: + include: + - os: linux + env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=11 + - os: linux + env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=17 + - os: linux + env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=2a + - os: linux + env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=17 + - os: linux + env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=2a + +addons: + apt: + sources: + - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' + key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' + - sourceline: 'ppa:ubuntu-toolchain-r/test' + packages: + - g++-7 + - g++-9 + - clang-7 + - clang-10 + - libopenblas-base + - rpm2cpio + - cpio + - clinfo + - opencl-headers + - ocl-icd-opencl-dev + +before_install: + - if [ ${TRAVIS_OS_NAME} == "linux" ]; then .ci/install-ocl-ubuntu.sh; fi + - .ci/install-clblas.sh + - cmake --version; + - ${CC} --version; + - ${CXX} --version; + +install: + - cd .. + - git clone -b master --depth 1 https://github.com/boostorg/boost.git boost-root + - cd boost-root + - git submodule update --init --jobs 8 tools/build + - git submodule update --init --jobs 8 libs/config + - git submodule update --init --jobs 8 tools/boostdep + - mkdir -p libs/numeric/ + - cp -rp $TRAVIS_BUILD_DIR/. libs/numeric/ublas + - python tools/boostdep/depinst/depinst.py -I benchmarks numeric/ublas + - ./bootstrap.sh + - ./b2 -j 8 headers + - export BOOST_ROOT="`pwd`" + +# use script: to execute build steps +script: + - |- + echo "using $TOOLSET : : $COMPILER ;" >> ~/user-config.jam; + echo "using clblas : : ${CLBLAS_PREFIX}/include ${CLBLAS_PREFIX}/lib ;" >> ~/user-config.jam; + cp $TRAVIS_BUILD_DIR/opencl.jam ~/ + cp $TRAVIS_BUILD_DIR/clblas.jam ~/ + - cd libs/numeric/ublas + - $BOOST_ROOT/b2 -j 8 test toolset=$TOOLSET cxxstd=$CXXSTD + +notifications: + email: + on_success: always \ No newline at end of file diff --git a/README.md b/README.md index 5ea5e1a1a..22ae6db18 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org ## Build Status -#### Build & Test +#### Tensor Build & Test | Operating System | Compiler | [`master`](https://github.com/boostorg/ublas/tree/master) | [`develop`](https://github.com/boostorg/ublas/tree/develop) | | :-------------------------: | :-----------------: | :----------------------------------------------------------: | :----------------------------------------------------------: | @@ -35,7 +35,7 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org | Windows 10 (x86_64) | msvc-{14.16, 14.26} | [![Windows MSVC](https://github.com/boostorg/ublas/workflows/Windows%20MSVC/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Windows+MSVC%22+branch%3Amaster) | [![Windows MSVC](https://github.com/boostorg/ublas/workflows/Windows%20MSVC/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Windows+MSVC%22+branch%3Adevelop) | | MacOS Catalina (x86_64) | clang-11 | [![Apple Clang](https://github.com/boostorg/ublas/workflows/Apple%20Clang/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Apple+Clang%22+branch%3Amaster) | [![Apple Clang](https://github.com/boostorg/ublas/workflows/Apple%20Clang/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Apple+Clang%22+branch%3Adevelop) | -#### Additional Checks +#### Tensor Additional Checks | Checks | [`master`](https://github.com/boostorg/ublas/tree/master) | [`develop`](https://github.com/boostorg/ublas/tree/develop) | | :-----------: | :----------------------------------------------------------: | :----------------------------------------------------------: | @@ -46,7 +46,7 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org | Clang-Format | [![Code Format](https://github.com/boostorg/ublas/workflows/Code%20Format/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Code+Format%22+branch%3Amaster) | [![Code Format](https://github.com/boostorg/ublas/workflows/Code%20Format/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Code+Format%22+branch%3Adevelop) | | Clang-Tidy | [![Clang tidy checks](https://github.com/boostorg/ublas/workflows/Clang%20tidy%20checks/badge.svg?branch=master)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Clang+tidy+checks%22+branch%3Amaster) | [![Clang tidy checks](https://github.com/boostorg/ublas/workflows/Clang%20tidy%20checks/badge.svg?branch=develop)](https://github.com/boostorg/ublas/actions?query=workflow%3A%22Clang+tidy+checks%22+branch%3Adevelop) | -#### Build Information +#### Tensor Build Information | OS | Toolchain | Compiler Flags | | :----------------: | :-------------: | :-----------------------------------------------: | @@ -60,7 +60,12 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org | Clang Tidy | Clang-Tidy-10 | [Configuration File](.clang-tidy) | | Clang Format | Clang-Format-10 | [Configuration File](.clang-format) | +#### uBLAS CI +Branch | Travis | Appveyor | Regression | Docs +:-----: | ------ | --------- | ----------- | ----- + [`master`](https://github.com/boostorg/ublas/tree/master) | [![Build Status](https://travis-ci.org/boostorg/ublas.svg?branch=master)](https://travis-ci.org/boostorg/ublas) | [![Build status](https://ci.appveyor.com/api/projects/status/ctu3wnfowa627ful/branch/master?svg=true)](https://ci.appveyor.com/project/stefanseefeld/ublas/branch/master) | [![ublas](https://img.shields.io/badge/ublas-master-blue.svg)](https://www.boost.org/development/tests/master/developer/numeric-ublas.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/release/libs/numeric) + [`develop`](https://github.com/boostorg/ublas/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/ublas.svg?branch=develop)](https://travis-ci.org/boostorg/ublas) | [![Build status](https://ci.appveyor.com/api/projects/status/ctu3wnfowa627ful/branch/develop?svg=true)](https://ci.appveyor.com/project/stefanseefeld/ublas/branch/develop) | [![ublas](https://img.shields.io/badge/ublas-develop-blue.svg)](https://www.boost.org/development/tests/develop/developer/numeric-ublas.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/release/libs/numeric) ## Directories From a822eaf89fa51d340b658c5021786453fc9d8150 Mon Sep 17 00:00:00 2001 From: Ashar Khan Date: Sat, 4 Jul 2020 16:21:19 +0530 Subject: [PATCH 3/4] Add Copyright notice and refactor windows matrix --- .github/workflows/address_san.yml | 4 ++++ .github/workflows/apple_clang.yml | 4 ++++ .github/workflows/clangtidy_check.yml | 4 ++++ .github/workflows/clangtidy_review.yml | 4 ++++ .github/workflows/code_format.yml | 4 ++++ .github/workflows/linux_clang.yml | 4 ++++ .github/workflows/linux_gcc.yml | 4 ++++ .github/workflows/thread_san.yml | 4 ++++ .github/workflows/ub_san.yml | 4 ++++ .github/workflows/windows_msvc.yml | 12 ++++++++---- 10 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.github/workflows/address_san.yml b/.github/workflows/address_san.yml index 74d75000c..25e77eab9 100644 --- a/.github/workflows/address_san.yml +++ b/.github/workflows/address_san.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Address Sanitizer # Trigger on Push to the repository, regardless of the branch. # For fine tune, You can add specific branches or tags. diff --git a/.github/workflows/apple_clang.yml b/.github/workflows/apple_clang.yml index 7136c8af0..fe7f43036 100644 --- a/.github/workflows/apple_clang.yml +++ b/.github/workflows/apple_clang.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Apple Clang on: [push, pull_request] diff --git a/.github/workflows/clangtidy_check.yml b/.github/workflows/clangtidy_check.yml index f9e79f290..45e51ea07 100644 --- a/.github/workflows/clangtidy_check.yml +++ b/.github/workflows/clangtidy_check.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Clang tidy checks on: [push] diff --git a/.github/workflows/clangtidy_review.yml b/.github/workflows/clangtidy_review.yml index 786843c1d..b60fa69ee 100644 --- a/.github/workflows/clangtidy_review.yml +++ b/.github/workflows/clangtidy_review.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Clang tidy Review on: [pull_request] diff --git a/.github/workflows/code_format.yml b/.github/workflows/code_format.yml index 36de644d9..17f9a308c 100644 --- a/.github/workflows/code_format.yml +++ b/.github/workflows/code_format.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: "Code Format" on: [push, pull_request] diff --git a/.github/workflows/linux_clang.yml b/.github/workflows/linux_clang.yml index fe3b16322..0e3a19b6c 100644 --- a/.github/workflows/linux_clang.yml +++ b/.github/workflows/linux_clang.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Linux Clang Release # Trigger on Push to the repository, regardless of the branch. # For fine tune, You can add specific branches or tags. diff --git a/.github/workflows/linux_gcc.yml b/.github/workflows/linux_gcc.yml index 589041984..8a071efa7 100644 --- a/.github/workflows/linux_gcc.yml +++ b/.github/workflows/linux_gcc.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Linux GCC Debug # Trigger on Push to the repository, regardless of the branch. # For fine tune, You can add specific branches or tags. diff --git a/.github/workflows/thread_san.yml b/.github/workflows/thread_san.yml index 9b224f3d7..6bd0c928f 100644 --- a/.github/workflows/thread_san.yml +++ b/.github/workflows/thread_san.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Thread Sanitizer # Trigger on Push to the repository, regardless of the branch. # For fine tune, You can add specific branches or tags. diff --git a/.github/workflows/ub_san.yml b/.github/workflows/ub_san.yml index e687aa752..0cf8f22b7 100644 --- a/.github/workflows/ub_san.yml +++ b/.github/workflows/ub_san.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: Undefined Behaviour Sanitizer # Trigger on Push to the repository, regardless of the branch. # For fine tune, You can add specific branches or tags. diff --git a/.github/workflows/windows_msvc.yml b/.github/workflows/windows_msvc.yml index c566c260e..b066f4151 100644 --- a/.github/workflows/windows_msvc.yml +++ b/.github/workflows/windows_msvc.yml @@ -1,3 +1,7 @@ +# Copyright (c) 2020 Mohammad Ashar Khan +# Distributed under Boost Software License, Version 1.0 +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: "Windows MSVC" on: [push, pull_request] @@ -9,10 +13,10 @@ jobs: fail-fast: false matrix: config: - - {os: windows-2016, toolset: msvc, version: 14.16, cxxstd: 11, env: "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} - - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: 11, env: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} - - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: 17, env: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} - - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: latest, env: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"} + - {os: windows-2016, toolset: msvc, version: 14.16, cxxstd: 11} + - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: 11} + - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: 17} + - {os: windows-2019, toolset: msvc, version: 14.26, cxxstd: latest} steps: - uses: actions/checkout@v2 From 985711e913ac31334e9e27bb3d17646948a1def7 Mon Sep 17 00:00:00 2001 From: Ashar Date: Wed, 15 Jul 2020 07:40:32 +0000 Subject: [PATCH 4/4] Add CMake support to build and test --- .gitignore | 3 +- CMakeLists.txt | 36 ++++++++++++++++++++ benchmarks/CMakeLists.txt | 36 ++++++++++++++++++++ examples/tensor/CMakeLists.txt | 24 +++++++++++++ test/tensor/CMakeLists.txt | 62 ++++++++++++++++++++++++++++++++++ 5 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt create mode 100644 benchmarks/CMakeLists.txt create mode 100644 examples/tensor/CMakeLists.txt create mode 100644 test/tensor/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 51858600e..5dfa79291 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode/ -.DS_Store \ No newline at end of file +.DS_Store +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..d92bdd13c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.12) + +project("Boost.uBLAS.Test" + DESCRIPTION "Boost.uBLAS is part of the Boost C++ Libraries. It is directed towards scientific computing on the level of basic linear and multilinear algebra operations with tensors, matrices and vectors." + HOMEPAGE_URL "https://github.com/boostorg/ublas") + + +option(BUILD_EXAMPLES "Build the examples directory" ON) +option(BUILD_TENSOR_TEST "Build Tensor Unit Tests" ON) +option(BUILD_BENCHMARKS "Build Benchmarks Directory" ON) + +set(BOOST_HEADERS_DIR "" CACHE PATH "Directory of include files generated by b2 headers") + +if(BOOST_HEADERS_DIR STREQUAL "") + message(STATUS "No Boost Headers specified, Looking for System installed headers") + find_package(Boost COMPONENTS unit_test_framework REQUIRED) + set(BOOST_HEADERS_DIR ${Boost_INCLUDE_DIRS} CACHE PATH "System Boost Installation include Directory" FORCE) + message(STATUS "Using Boost headers at : ${BOOST_HEADERS_DIR}. Use -DBOOST_HEADER_DIR= to overwrite") +endif() + +set(UBLAS_HEADER_DIR ${CMAKE_SOURCE_DIR}/include) + +if(BUILD_EXAMPLES) + message(STATUS "Examples will be build. You will have to run them manually") + add_subdirectory(examples/tensor) +endif() + +if(BUILD_TENSOR_TEST) + message(STATUS "Tensor Unit Tests will be build. Use ctest to run the tests") + add_subdirectory(test/tensor) +endif() + +if(BUILD_BENCHMARKS) + message(STATUS "Benchmarks will be build. You will have to run them manually") + add_subdirectory(benchmarks) +endif() diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt new file mode 100644 index 000000000..6b024db35 --- /dev/null +++ b/benchmarks/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.12) + +project("Boost.uBLAS.Benchmark" + DESCRIPTION "Boost.uBLAS.Benchmark is part of the Boost C++ Libraries. It is directed towards benchmarking various operations within Boost.uBLAS" + HOMEPAGE_URL "https://github.com/boostorg/ublas") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include_directories(SYSTEM ${BOOST_HEADERS_DIR}) +include_directories(${UBLAS_HEADER_DIR}) + +# If you decide to use any other Boost library that requires linkage +# you should add them to the list of components in the below line. +# To link call `link_libraries()`. This library will be linked to all targets. +# To link to specific target, use `target_link_libraries( )` after +# you have created the target with `add_executable( )` + +find_package(Boost COMPONENTS program_options REQUIRED) +link_libraries(${Boost_PROGRAM_OPTIONS_LIBRARY}) + +# Add new benchmarks here. + +add_executable(add add.cpp) +add_executable(mm_prod mm_prod.cpp) +add_executable(mv_prod mv_prod.cpp) +add_executable(inner_prod inner_prod.cpp) +add_executable(outer_prod outer_prod.cpp) + +# Add a reference to benchamark here. +add_executable(add_ref reference/add.cpp) +add_executable(mm_prod_ref reference/mm_prod.cpp) +add_executable(mv_prod_ref reference/mv_prod.cpp) +add_executable(inner_prod_ref reference/inner_prod.cpp) +add_executable(outer_prod_ref reference/outer_prod.cpp) + diff --git a/examples/tensor/CMakeLists.txt b/examples/tensor/CMakeLists.txt new file mode 100644 index 000000000..593105c5e --- /dev/null +++ b/examples/tensor/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.12) + +project("Boost.uBLAS.Examples" + DESCRIPTION "Boost.uBLAS.Examples is part of the Boost C++ Libraries. It is directed towards showing different use cases and examples to get started with various operations within Boost.uBLAS" + HOMEPAGE_URL "https://github.com/boostorg/ublas") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include_directories(SYSTEM ${BOOST_HEADERS_DIR}) +include_directories(${UBLAS_HEADER_DIR}) + +# Add a new example here. Use spaces and respect my beautiful alignment. + +add_executable(construction_access construction_access.cpp) +add_executable(simple_expressions simple_expressions.cpp) +add_executable(dynamic_prod_expressions dynamic_prod_expressions.cpp) +add_executable(fixed_rank_prod_expressions fixed_rank_prod_expressions.cpp) +add_executable(static_prod_expressions static_prod_expressions.cpp) +add_executable(fixed_rank_tensor fixed_rank_tensor.cpp) +add_executable(static_tensor static_tensor.cpp) +add_executable(einstein_notation einstein_notation.cpp) +add_executable(tensor_construction tensor_construction.cpp) + diff --git a/test/tensor/CMakeLists.txt b/test/tensor/CMakeLists.txt new file mode 100644 index 000000000..f4ae141f4 --- /dev/null +++ b/test/tensor/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.12) + +project("Boost.uBLAS.TensorTest" + DESCRIPTION "Boost.uBLAS.TensorTest is part of the Boost C++ Libraries. It is directed towards testing Boost.uBLAS.Tensor various operations within Boost.uBLAS" + HOMEPAGE_URL "https://github.com/boostorg/ublas") + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include_directories(SYSTEM ${BOOST_HEADERS_DIR}) +include_directories(${UBLAS_HEADER_DIR}) + +add_executable( + test_tensor + test_tensor.cpp + test_strides.cpp + test_expression.cpp + test_operators_comparison.cpp + test_operators_arithmetic.cpp + test_multiplication.cpp + test_multi_index_utility.cpp + test_multi_index.cpp + test_extents.cpp + test_expression_evaluation.cpp + test_einstein_notation.cpp + test_algorithms.cpp + test_tensor_matrix_vector.cpp + test_functions.cpp) + +add_executable( + test_static_tensor + test_static_tensor.cpp + test_static_extents.cpp + test_static_strides.cpp + test_static_operators_arithmetic.cpp + test_static_operators_comparison.cpp + test_static_expression_evaluation.cpp + test_static_tensor_matrix_vector.cpp + test_static_functions.cpp) + +add_executable( + test_fixed_rank_tensor + test_fixed_rank_tensor.cpp + test_fixed_rank_extents.cpp + test_fixed_rank_strides.cpp + test_fixed_rank_operators_arithmetic.cpp + test_fixed_rank_operators_comparison.cpp + test_fixed_rank_expression_evaluation.cpp + test_fixed_rank_tensor_matrix_vector.cpp + test_fixed_rank_functions.cpp) + +find_package(Boost COMPONENTS unit_test_framework REQUIRED) + +target_link_libraries(test_tensor ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +target_link_libraries(test_static_tensor ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +target_link_libraries(test_fixed_rank_tensor ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + +enable_testing() + +add_test(NAME TensorTests COMMAND test_tensor) +add_test(NAME TensorFixedRank COMMAND test_fixed_rank_tensor) +add_test(NAME TensorStatic COMMAND test_static_tensor)