xtensor-stack / zarray Goto Github PK
View Code? Open in Web Editor NEWDynamically typed N-D expression system based on xtensor
License: BSD 3-Clause "New" or "Revised" License
Dynamically typed N-D expression system based on xtensor
License: BSD 3-Clause "New" or "Revised" License
I was playing a bit with zarray by creating some new tests and I got this one to fail.
Am I missing something or doing something stupid? Looka like the last +d
is ommited.
I added a pr with the failing test in #53
TEST(zfunction, math_operator_extended)
{
using add_dispatcher_type = zdispatcher_t<detail::plus, 2>;
add_dispatcher_type::init();
xarray<int> a = {{1, 1}, {1, 1}};
xarray<int> b = {{2, 2}, {2, 2}};
xarray<int> c = {{3, 3}, {3, 3}};
xarray<int> d = {{4, 4}, {4, 4}};
auto res = xarray<int>::from_shape({2, 2});
zarray za(a);
zarray zb(b);
zarray zc(c);
zarray zd(d);
zarray zres(res);
auto f = ((za+zb) + (zc+zd)) + zd;
zassign_args args;
f.assign_to(zres.get_implementation(), args);
auto expected = xt::eval((a+b) + (c+d) + d);
EXPECT_EQ(res, expected);
}
In #28 we implemented views on zarray with the following limitation: if the zarray holds an expression which is already a view, then this expression is evaluated and stored in an array before getting the new view (if the zarray holds an expression which is not a view, then this expression is not evaluated before getting the new view).
We might want to improve this behavior in the future, and "merge" consecutive views into a single one.
With a fresh conda environment:
mamba install make cmake gtest compilers xtensor=0.23.0 xtensor-io=0.12.0 xsimd=7.4.8 nlohmann_json=3.2.0
After entering:
cmake .. -DBUILD_TESTS=ON
make xtest
I get the following errors:
In file included from /home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float.hpp:14,
from /home/david/github/davidbrochart/zarray/include/zarray/zarray_impl.hpp:14,
from /home/david/github/davidbrochart/zarray/include/zarray/zarray.hpp:19,
from /home/david/github/davidbrochart/zarray/test/test_zarray.cpp:11:
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp: In function 'T half_float::detail::half2int(unsigned int)':
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp:962:21: error: call of overloaded 'raise(<unnamed enum>)' is ambiguous
962 | raise(FE_INVALID);
| ^
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp:292:15: note: candidate: 'void half_float::detail::raise(int, bool)'
292 | inline void raise(int HALF_UNUSED_NOERR(flags), bool HALF_UNUSED_NOERR(cond) = true) {
| ^~~~~
In file included from /home/david/mambaforge/envs/zarray-dev/x86_64-conda-linux-gnu/sysroot/usr/include/sys/wait.h:31,
from /home/david/mambaforge/envs/zarray-dev/include/gtest/internal/gtest-internal.h:45,
from /home/david/mambaforge/envs/zarray-dev/include/gtest/gtest.h:62,
from /home/david/github/davidbrochart/zarray/test/test_zarray.cpp:10:
/home/david/mambaforge/envs/zarray-dev/x86_64-conda-linux-gnu/sysroot/usr/include/signal.h:138:12: note: candidate: 'int raise(int)'
138 | extern int raise (int __sig) __THROW;
| ^~~~~
In file included from /home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float.hpp:14,
from /home/david/github/davidbrochart/zarray/include/zarray/zarray_impl.hpp:14,
from /home/david/github/davidbrochart/zarray/include/zarray/zarray.hpp:19,
from /home/david/github/davidbrochart/zarray/test/test_zarray.cpp:11:
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp:979:21: error: call of overloaded 'raise(<unnamed enum>)' is ambiguous
979 | raise(FE_INVALID);
| ^
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp:292:15: note: candidate: 'void half_float::detail::raise(int, bool)'
292 | inline void raise(int HALF_UNUSED_NOERR(flags), bool HALF_UNUSED_NOERR(cond) = true) {
| ^~~~~
In file included from /home/david/mambaforge/envs/zarray-dev/x86_64-conda-linux-gnu/sysroot/usr/include/sys/wait.h:31,
from /home/david/mambaforge/envs/zarray-dev/include/gtest/internal/gtest-internal.h:45,
from /home/david/mambaforge/envs/zarray-dev/include/gtest/gtest.h:62,
from /home/david/github/davidbrochart/zarray/test/test_zarray.cpp:10:
/home/david/mambaforge/envs/zarray-dev/x86_64-conda-linux-gnu/sysroot/usr/include/signal.h:138:12: note: candidate: 'int raise(int)'
138 | extern int raise (int __sig) __THROW;
| ^~~~~
In file included from /home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float.hpp:14,
from /home/david/github/davidbrochart/zarray/include/zarray/zarray_impl.hpp:14,
from /home/david/github/davidbrochart/zarray/include/zarray/zarray.hpp:19,
from /home/david/github/davidbrochart/zarray/test/test_zarray.cpp:11:
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp:981:21: error: call of overloaded 'raise(<unnamed enum>)' is ambiguous
981 | raise(FE_INEXACT);
| ^
/home/david/mambaforge/envs/zarray-dev/include/xtl/xhalf_float_impl.hpp:292:15: note: candidate: 'void half_float::detail::raise(int, bool)'
292 | inline void raise(int HALF_UNUSED_NOERR(flags), bool HALF_UNUSED_NOERR(cond) = true) {
| ^~~~~
In file included from /home/david/mambaforge/envs/zarray-dev/x86_64-conda-linux-gnu/sysroot/usr/include/sys/wait.h:31,
from /home/david/mambaforge/envs/zarray-dev/include/gtest/internal/gtest-internal.h:45,
from /home/david/mambaforge/envs/zarray-dev/include/gtest/gtest.h:62,
from /home/david/github/davidbrochart/zarray/test/test_zarray.cpp:10:
/home/david/mambaforge/envs/zarray-dev/x86_64-conda-linux-gnu/sysroot/usr/include/signal.h:138:12: note: candidate: 'int raise(int)'
138 | extern int raise (int __sig) __THROW;
| ^~~~~
It looks like half-float's raise
function conflicts with signal.h
's one. Any idea @0xBYTESHIFT?
This currently doesn't work (see #20):
std::vector<size_t> shape = {4, 4};
std::vector<size_t> chunk_shape = {2, 2};
auto a1 = chunked_array<int>(shape, chunk_shape);
auto a2 = chunked_array<int>(shape, chunk_shape) = arange(4 * 4).reshape({4, 4});
zarray z1(a1);
z1 = a2;
a1
is not assigned to.
Hello all,
I was trying to compile xtensor-zarr
but found out that some zarray
headers were not installed through make install
.
Those headers are:
${ZARRAY_INCLUDE_DIR}/zarray/zfunctors.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zarray_impl_register.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zmpl.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zarray_temporary_pool.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zinit.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zreducers.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zreducer.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zreducer_options.hpp
${ZARRAY_INCLUDE_DIR}/zarray/zarray_zarray.hpp
It seems that those missing headers are not used directly in xtensor-zarr
, but they are included for internal usages of other zarray
headers.
I'm not sure whether it is the intention or not, but installing missing headers like #66 allows me to compile xtensor-zarr
successfully.
Also, zarray
depends on nlohmann_json
, but this library is not mentioned in README/Dependencies.
-Hank
Currently only the overloads accepting floating point types are registered. This is due to an issue in xsimd that should be fixed in xtensor-stack/xsimd#402
this throws a bad_function_call
and gdb says "no stack" =/.
Failing test is in #62
TEST_CASE("bad_function_call")
{
zdispatcher_t<detail::plus, 2>::init();
auto x0 = xarray<int>::from_shape({2,2});
auto x1 = xarray<int>::from_shape({2,2});
zarray z0(x0);
zarray z1(x1);
auto res = xarray<double>::from_shape({2,2});
zarray zres(res);
zres = x0 + x1;
}
without the explicit init I get a "callback not found" exception as expected
Assigning an xarray
to a zarray
doesn't seem to work:
auto a1 = xarray<int>();
auto a2 = xarray<int>({0, 1});
zarray z1(a1);
z1 = a2;
/home/david/miniforge3/envs/xtensor-zarr-dev/include/zarray/zarray_impl.hpp:462:9: error: no matching function for call to 'xt::xarray_container<xt::uvector<int, std::allocator<int> >, (xt::layout_type)1, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>::resize(const shape_type&) const'
m_array.resize(shape);
^~~~~~~
With noalias
either:
auto a1 = xarray<int>();
auto a2 = xarray<int>({0, 1});
zarray z1(a1);
noalias(z1) = a2;
/home/david/miniforge3/envs/xtensor-zarr-dev/include/zarray/zassign.hpp:32:17: error: 'const class xt::xarray_container<xt::uvector<int, std::allocator<int> >, (xt::layout_type)1, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>' has no member named 'assign_to'; did you mean 'assign'?
rhs.assign_to(lhs.get_implementation());
~~~~^~~~~~~~~
assign
Wrapping a2
in a zarray
and assigning it fails at run-time:
auto a1 = xarray<int>();
auto a2 = xarray<int>({0, 1});
zarray z1(a1);
zarray z2(a2);
z1 = z2;
unknown file: Failure
C++ exception with description "callback not found" thrown in the test body.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.