Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make arraymancer compatible with ORC and latest devel #573

Merged
merged 6 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
max-parallel: 20
matrix:
# branch: [version-1-0, version-1-2, version-1-4, version-1-6] # [devel]
nim: ['version-1-4', 'version-1-6'] # 'devel'
nim: ['version-1-4', 'version-1-6', 'devel'] # 'devel'
target:
- os: linux
cpu: amd64
Expand Down Expand Up @@ -216,6 +216,14 @@ jobs:
# Run the tests.
nimble test

- name: Run Arraymancer tests with ORC
working-directory: arraymancer
run: |
export ARRAYMANCER_TEST_LANG=${{ matrix.test_lang }}
nimble install -y --depsOnly
# Run the tests.
nimble test_orc_release

- name: Build docs
if: >
github.event_name == 'push' && github.ref == 'refs/heads/master' &&
Expand Down
6 changes: 5 additions & 1 deletion src/arraymancer/io/io_csv.nim
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ proc read_csv*[T: SomeNumber|bool|string](
elif T is bool:
parser = parseBool
elif T is string:
parser = proc(x: string): string = shallowCopy(result, x) # no-op
parser = proc(x: string): string =
when defined(gcArc) or defined(gcOrc):
result = x
else:
shallowCopy(result, x) # no-op
ringabout marked this conversation as resolved.
Show resolved Hide resolved

# 1. count number of lines and columns using memfile interface
let (numRows, numCols) = countLinesAndCols(csvPath, separator, quote, skipHeader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ proc syevr*[T: SomeFloat](a: var Tensor[T], uplo: static char, return_eigenvecto
lwork: int32 = -1 # dimension of a workspace array
work_size: T
liwork: int32 = -1 # dimension of a second workspace array
iwork: seq[cint]
iwork: seq[int32]
iwork_size: int32
info: int32

Expand All @@ -84,7 +84,7 @@ proc syevr*[T: SomeFloat](a: var Tensor[T], uplo: static char, return_eigenvecto

# Setting up output
var
isuppz: seq[cint] # unused
isuppz: seq[int32] # unused
isuppz_ptr: ptr int32

eigenval = newTensorUninit[T](a.shape[0]) # Even if less eigenval are selected Lapack requires this much workspace
Expand Down Expand Up @@ -246,7 +246,7 @@ proc gesdd*[T: SomeFloat](a: var Tensor[T], U, S, Vh: var Tensor[T], scratchspac
work_size: T
lwork = -1'i32 # size query
info: int32
iwork = newSeqUninit[cint](8 * k)
iwork = newSeqUninit[int32](8 * k)

U.newMatrixUninitColMajor(ldu, ucol)
S = newTensorUninit[T](k.int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ proc gelsd*[T: SomeFloat](
singular_values = newTensorUninit[T](minmn) # will hold the singular values of A

var # Temporary parameter values
iwork = newSeqUninit[cint](liwork)
iwork = newSeqUninit[int32](liwork)
info, rank: int32
lwork: int32 = -1

Expand Down
10 changes: 8 additions & 2 deletions src/arraymancer/tensor/higher_order_foldreduce.nim
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ proc reduce*[T](t: Tensor[T],
## a.reduce(max) ## This returns the maximum value in the Tensor.

t.reduce_inline():
shallowCopy(x, f(x,y))
when defined(gcArc) or defined(gcOrc):
x = f(x,y) # hopefully nvro will work
else:
shallowCopy(x, f(x,y))

proc reduce*[T](t: Tensor[T],
f: (Tensor[T], Tensor[T]) -> Tensor[T],
Expand All @@ -142,4 +145,7 @@ proc reduce*[T](t: Tensor[T],
## - A tensor aggregate of the function called all elements of the tensor

t.reduce_axis_inline(axis):
shallowCopy(x, f(x,y))
when defined(gcArc) or defined(gcOrc):
x = f(x,y) # hopefully nvro will work
else:
shallowCopy(x, f(x,y))
4 changes: 2 additions & 2 deletions tests/tensor/test_init.nim
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ proc main() =
var t: TestObject
t.x = @[1.0, 2, 3, 4].toTensor()
t.x = t.x
doAssert t.x.storage.isNil, "If you see this message, bug Nim #16185 is fixed." &
" Remove this test or set it to `not t.x.isNil`!"
when (NimMajor, NimMinor) >= (1, 6): # works since 1.6; see https://github.com/nim-lang/Nim/issues/16185
doAssert not t.x.storage.isNil

test "Init tensor from raw buffer":
let size = 100
Expand Down