Skip to content

Commit 22955ad

Browse files
committed
First commit after local testing
1 parent 3f41f9c commit 22955ad

File tree

8 files changed

+565
-2
lines changed

8 files changed

+565
-2
lines changed

.github/workflows/docs.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Documents
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
docs:
10+
name: Deploy the dev version of documents to GitHub Pages
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: dtolnay/rust-toolchain@master
16+
with:
17+
toolchain: nightly
18+
- name: Docs
19+
run: cargo doc --workspace --no-deps --all-features
20+
env:
21+
RUSTDOCFLAGS: "--enable-index-page -Zunstable-options"
22+
- name: Deploy
23+
uses: peaceiris/actions-gh-pages@v3
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: ./target/doc

.github/workflows/test.yml

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
9+
branches:
10+
- main
11+
- master
12+
13+
# cargo error handling is wrapped by ci-cargo, for simplicity and better logging.
14+
# To use ci-cargo in a step, source ci-cargo.ps1 (using `. ./ci-cargo.ps`, note the extra dot in front).
15+
# ci-cargo does not handle correctly -- separator, so wrap it in quotes ('--')
16+
# A special named parameter called `ActionName` can be used to set the name of current ci-cargo action,
17+
# used as `ci-cargo .... -ActionName "Called for documentation purposes"`.
18+
jobs:
19+
# All tests
20+
tests:
21+
runs-on: ${{ matrix.config.os }}
22+
23+
name: ${{ matrix.config.os }} (R-${{ matrix.config.r }} rust-${{ matrix.config.rust-version }})
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
config:
29+
# On Windows,
30+
#
31+
# * for R >= 4.2, both the MSVC toolchain and the GNU toolchain should
32+
# work. Since our main support is on MSVC, we mainly test MSVC here.
33+
# Also, at least one GNU case should be included so that we can
34+
# detect when something gets broken.
35+
# * for R < 4.2, the MSVC toolchain must be used to support
36+
# cross-compilation for the 32-bit.
37+
- {os: windows-latest, r: 'release', rust-version: 'stable-msvc', rtools-version: '42'}
38+
- {os: windows-latest, r: 'devel', rust-version: 'stable-msvc'}
39+
- {os: windows-latest, r: 'release', rust-version: 'stable-gnu', rtools-version: '42'}
40+
- {os: windows-latest, r: '4.1', rust-version: 'stable-msvc'} # TODO: Remove this runner when we drop the support for R < 4.2
41+
42+
- {os: macOS-latest, r: 'release', rust-version: 'stable'}
43+
# - {os: macOS-latest, r: 'release', rust-version: 'nightly'}
44+
# - {os: macOS-latest, r: 'devel', rust-version: 'stable'}
45+
# - {os: macOS-latest, r: 'oldrel', rust-version: 'stable'}
46+
47+
- {os: ubuntu-latest, r: 'release', rust-version: 'stable', check_fmt: true}
48+
- {os: ubuntu-latest, r: 'release', rust-version: 'nightly'}
49+
# R-devel requires LD_LIBRARY_PATH
50+
- {os: ubuntu-latest, r: 'devel', rust-version: 'stable'}
51+
- {os: ubuntu-latest, r: 'oldrel', rust-version: 'stable'}
52+
53+
54+
55+
env:
56+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
57+
58+
# This environment variable enables support for pseudo multi-target cargo builds.
59+
# Current stable Rust does not support multi-targeting,
60+
# see https://github.com/rust-lang/cargo/issues/8176
61+
# The variable is treated as a comma-separated list of valid Rust targets.
62+
# 'default' value emits no '--target' flag.
63+
# E.g.: BUILD_TARGETS=i686-pc-windows-gnu,x86_64-pc-windows-gnu builds two times,
64+
# each time providing '--target=*-pc-windows-gnu' flag to cargo.
65+
BUILD_TARGETS: default
66+
67+
# PowerShell core is available on all platforms and can be used to unify scripts
68+
defaults:
69+
run:
70+
shell: pwsh
71+
72+
steps:
73+
- uses: actions/checkout@v3
74+
75+
- name: Set up Rust
76+
uses: dtolnay/rust-toolchain@master
77+
with:
78+
toolchain: ${{ matrix.config.rust-version }}
79+
components: rustfmt, clippy
80+
81+
- name: Set up R
82+
uses: r-lib/actions/setup-r@v2
83+
with:
84+
r-version: ${{ matrix.config.r }}
85+
rtools-version: ${{ matrix.config.rtools-version }}
86+
# TODO: enable RSPM when all the packages are available
87+
use-public-rspm: false
88+
89+
- name: Set up Pandoc
90+
uses: r-lib/actions/setup-pandoc@v2
91+
92+
- name: Configure Windows (R >= 4.2)
93+
if: startsWith(runner.os, 'Windows') && matrix.config.r != '4.1'
94+
run: |
95+
if ("${{ matrix.config.rtools-version }}" -eq "42") {
96+
$rtools_home = "C:\rtools42" # for R 4.2
97+
} else {
98+
$rtools_home = "C:\rtools43" # for R >= 4.3
99+
}
100+
101+
# c.f. https://github.com/wch/r-source/blob/f1501504df8df1668a57d3a1b6f80167f24441d3/src/library/profile/Rprofile.windows#L70-L71
102+
echo "${rtools_home}\x86_64-w64-mingw32.static.posix\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
103+
echo "${rtools_home}\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
104+
echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\x64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
105+
106+
# Add target
107+
rustup target add x86_64-pc-windows-gnu
108+
echo "BUILD_TARGETS=x86_64-pc-windows-gnu" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append ;
109+
110+
# The following lines add two tweaks:
111+
#
112+
# 1. Change the linker name to "x86_64-w64-mingw32.static.posix-gcc.exe".
113+
# 2. Add empty libgcc_s.a and libgcc_eh.a, and add them to the compiler's
114+
# library search paths via `LIBRARY_PATH` envvar.
115+
#
116+
# The first tweak is needed because Rtools42 doesn't contain
117+
# "x86_64-w64-mingw32-gcc," which `rustc` uses as the default linker
118+
# for the `x86_64-pc-windows-gnu` target.
119+
#
120+
# If we use the Rtools' toolchain, the second tweak is also required.
121+
# `rustc` adds `-lgcc_eh` and `-lgcc_s` flags to the compiler, but
122+
# Rtools' GCC doesn't have `libgcc_eh` or `libgcc_s` due to the
123+
# compilation settings. So, in order to please the compiler, we need
124+
# to add empty `libgcc_eh` or `libgcc_s` to the library search paths.
125+
#
126+
# For more details, please refer to https://github.com/r-windows/rtools-packages/blob/2407b23f1e0925bbb20a4162c963600105236318/mingw-w64-gcc/PKGBUILD#L313-L316
127+
128+
New-Item -Path libgcc_mock -Type Directory
129+
New-Item -Path libgcc_mock\libgcc_eh.a -Type File
130+
New-Item -Path libgcc_mock\libgcc_s.a -Type File
131+
132+
New-Item -Path .cargo -ItemType Directory -Force
133+
$pwd_slash = echo "${PWD}" | % {$_ -replace '\\','/'}
134+
@"
135+
[target.x86_64-pc-windows-gnu]
136+
linker = "x86_64-w64-mingw32.static.posix-gcc.exe"
137+
138+
[env]
139+
LIBRARY_PATH = "${pwd_slash}/libgcc_mock"
140+
"@ | Out-File -FilePath .cargo/config.toml -Encoding utf8 -Append ;
141+
env:
142+
RUST_TOOLCHAIN: ${{ matrix.config.rust-version }}
143+
144+
# TODO: Remove this runner when we drop the support for R < 4.2
145+
- name: Configure Windows (R < 4.2)
146+
if: startsWith(runner.os, 'Windows') && matrix.config.r == '4.1'
147+
# 1. Add rust target
148+
# 2. Add target name to the $targets variable
149+
# 3. Add mingw32/mingw64 bin folders to PATH
150+
# 4. Add R x64/i386 folders to PATH
151+
run: |
152+
$targets=@()
153+
if ($env:RUST_TOOLCHAIN -notlike "*x86_64*") {
154+
rustup target add i686-pc-windows-gnu ;
155+
$targets+="i686-pc-windows-gnu"
156+
echo "${env:RTOOLS40_HOME}\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
157+
echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\i386" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
158+
}
159+
if ($env:RUST_TOOLCHAIN -notlike "*i686*") {
160+
rustup target add x86_64-pc-windows-gnu ;
161+
$targets+="x86_64-pc-windows-gnu"
162+
echo "${env:RTOOLS40_HOME}\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
163+
echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\x64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
164+
}
165+
echo "BUILD_TARGETS=$($targets -join ',')" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append ;
166+
env:
167+
RUST_TOOLCHAIN: ${{ matrix.config.rust-version }}
168+
169+
# This is required for ubuntu r-devel
170+
# 'Del alias:R' removes 'R' alias which prevents running R
171+
- name: Configure Linux
172+
if: startsWith(runner.os, 'linux')
173+
run: |
174+
Del alias:R
175+
echo "LD_LIBRARY_PATH=$(R -s -e 'cat(normalizePath(R.home()))')/lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
176+
177+
# Check code formatting. As this doesn't depend on the platform, do this only on one platform.
178+
- name: Check code formatting
179+
if: matrix.config.check_fmt
180+
run: cargo fmt -- --check
181+
182+
# For each target in the BUILD_TARGETS comma-separated list, run cargo build with appropriate target
183+
# Required by Windows builds, does not affect other platforms
184+
- name: Build
185+
run: |
186+
. ./ci-cargo.ps1
187+
foreach($target in ($env:BUILD_TARGETS).Split(',')) {
188+
ci-cargo build $(if($target -ne 'default') {"--target=$target"} ) -ActionName "Building for $target target"
189+
}
190+
# For each target in the BUILD_TARGETS comma-separated list, run cargo test with appropriate target
191+
# Required by Windows builds, does not affect other platforms
192+
# ! ci-cargo requires '--' to be wrapped in quotes (passed as an explicit string)
193+
- name: Run tests
194+
run: |
195+
. ./ci-cargo.ps1
196+
foreach($target in ($env:BUILD_TARGETS).Split(',')) {
197+
# Note: no feature is specified, which means such features like graphics, serde, ndarray, and num-complex are not tested here.
198+
ci-cargo test $(if($target -ne 'default') {"--target=$target"} ) '--' --nocapture -ActionName "Testing for $target target"
199+
}
200+

Cargo.toml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "r-blas-lapack-src"
3+
version = "0.1.0"
4+
edition = "2021"
5+
license = "MIT"
6+
authors = ["Balasubramanian Narasimhan <[email protected]>"]
7+
description = "The package provides a source of BLAS and LAPACK via R."
8+
documentation = "https://docs.rs/r-blas-lapack-src"
9+
homepage = "https://github.com/blas-lapack-rs/r-blas-lapack-src"
10+
repository = "https://github.com/blas-lapack-rs/r-blas-lapack-src"
11+
readme = "README.md"
12+
categories = ["science"]
13+
keywords = ["linear-algebra"]
14+
build = "build.rs"
15+
16+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
17+
18+
[dev-dependencies]
19+
libc = "0.2"

LICENSE.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# License
2+
3+
The project is licensed under the terms of the MIT License. You
4+
may obtain copies of the license at
5+
6+
* https://opensource.org/licenses/MIT
7+
8+
The following notice applies to every file of the project.
9+
10+
## The MIT License
11+
12+
```
13+
Copyright 2023 The r-blas-lapack-src Developers
14+
15+
Permission is hereby granted, free of charge, to any person obtaining a copy of
16+
this software and associated documentation files (the “Software”), to deal in
17+
the Software without restriction, including without limitation the rights to
18+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
19+
the Software, and to permit persons to whom the Software is furnished to do so,
20+
subject to the following conditions:
21+
22+
The above copyright notice and this permission notice shall be included in all
23+
copies or substantial portions of the Software.
24+
25+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
27+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
28+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
29+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31+
```

README.md

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# Rblas-src
2-
A source of BLAS via R
1+
# r-blas-lapack-src [![Package][package-img]][package-url] [![Documentation][documentation-img]][documentation-url] [![Build][build-img]][build-url]
2+
# r-blas-lapack-src
3+
4+
A source of [BLAS] and [LAPACK] via R. Note that only double precision
5+
routines are provided by R. The build script for this particilar crate
6+
owes a lot to [libR-sys](https://github.com/extendr/libR-sys) of the
7+
[extendr](https://github.com/extendr) project, with sections lifted
8+
from there, in addition to new code.
9+
10+
## [Architecture]
11+
12+
## Contribution
13+
14+
Your contribution is highly appreciated. Do not hesitate to open an issue or a
15+
pull request. Note that any contribution submitted for inclusion in the project
16+
will be licensed according to the terms given in [LICENSE.md](LICENSE.md).
17+
18+
[accelerate]: https://developer.apple.com/documentation/accelerate
19+
[architecture]: https://blas-lapack-rs.github.io/architecture
20+
[blas]: https://en.wikipedia.org/wiki/BLAS
21+
[lapack]: https://en.wikipedia.org/wiki/LAPACK
22+
23+
[build-img]: https://travis-ci.org/blas-lapack-rs/accelerate-src.svg?branch=master
24+
[build-url]: https://travis-ci.org/blas-lapack-rs/accelerate-src
25+
[documentation-img]: https://docs.rs/accelerate-src/badge.svg
26+
[documentation-url]: https://docs.rs/accelerate-src
27+
[package-img]: https://img.shields.io/crates/v/accelerate-src.svg
28+
[package-url]: https://crates.io/crates/accelerate-src
29+
30+

0 commit comments

Comments
 (0)