ddemidov / vexcl

Compare 034abe9 ... +0 ... 5ec2f10

Coverage Reach
vexcl/fft/unrolled_dft.hpp vexcl/fft/kernels.hpp vexcl/fft/plan.hpp vexcl/sort.hpp vexcl/backend/opencl/source.hpp vexcl/backend/opencl/filter.hpp vexcl/backend/opencl/kernel.hpp vexcl/backend/opencl/error.hpp vexcl/backend/opencl/context.hpp vexcl/backend/opencl/device_vector.hpp vexcl/backend/opencl/svm_vector.hpp vexcl/backend/opencl/event.hpp vexcl/backend/opencl/compiler.hpp vexcl/backend/opencl/image.hpp vexcl/backend/jit/source.hpp vexcl/backend/jit/kernel.hpp vexcl/backend/jit/context.hpp vexcl/backend/jit/compiler.hpp vexcl/backend/jit/device_vector.hpp vexcl/backend/jit/filter.hpp vexcl/backend/jit/event.hpp vexcl/backend/common.hpp vexcl/sparse/ell.hpp vexcl/sparse/distributed.hpp vexcl/sparse/csr.hpp vexcl/sparse/matrix.hpp vexcl/sparse/product.hpp vexcl/sparse/spmv_ops.hpp vexcl/spmat/hybrid_ell.inl vexcl/spmat/csr.inl vexcl/spmat/ccsr.hpp vexcl/spmat/inline_spmv.hpp vexcl/scan_by_key.hpp vexcl/operations.hpp vexcl/reduce_by_key.hpp vexcl/vector_view.hpp vexcl/stencil.hpp vexcl/scan.hpp vexcl/mba.hpp vexcl/vector.hpp vexcl/reductor.hpp vexcl/generator.hpp vexcl/spmat.hpp vexcl/tensordot.hpp vexcl/random.hpp vexcl/random/philox.hpp vexcl/random/threefry.hpp vexcl/temporary.hpp vexcl/tagged_terminal.hpp vexcl/logical.hpp vexcl/multivector.hpp vexcl/devlist.hpp vexcl/gather.hpp vexcl/profiler.hpp vexcl/detail/fusion.hpp vexcl/detail/backtrace.hpp vexcl/cache.hpp vexcl/eval.hpp vexcl/cast.hpp vexcl/multi_array.hpp vexcl/enqueue.hpp vexcl/vector_pointer.hpp vexcl/svm_vector.hpp vexcl/types.hpp vexcl/util.hpp vexcl/function.hpp vexcl/constant_address_space.hpp vexcl/constants.hpp vexcl/element_index.hpp vexcl/fft.hpp tests/spmv.cpp tests/vector_view.cpp tests/vector_arithmetics.cpp tests/sparse_matrices.cpp tests/multivector_arithmetics.cpp tests/stencil.cpp tests/generator.cpp tests/vector_create.cpp tests/sort.cpp tests/reduce_by_key.cpp tests/fft.cpp tests/deduce.cpp tests/vector_copy.cpp tests/scan_by_key.cpp tests/vector_pointer.cpp tests/temporary.cpp tests/events.cpp tests/tensordot.cpp tests/multivector_create.cpp tests/custom_kernel.cpp tests/tagged_terminal.cpp tests/random.cpp tests/mba.cpp tests/multi_array.cpp tests/context_setup.hpp tests/image.cpp tests/svm.cpp tests/cast.cpp tests/scan.cpp tests/threads.cpp tests/random_matrix.hpp tests/random_vector.hpp tests/types.cpp tests/eval.cpp tests/logical.cpp tests/context.cpp tests/reinterpret.cpp tests/constants.cpp tests/vector_io.cpp tests/dummy1.cpp tests/dummy2.cpp tests/boost_version.cpp CL/cl.hpp examples/devlist.cpp

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -79,23 +79,29 @@
Loading
79 79
80 80
    std::vector<size_t> i(m);
81 81
    std::generate(i.begin(), i.end(), [n](){ return rand() % n; });
82 -
    std::sort(i.begin(), i.end());
83 -
    i.resize( std::unique(i.begin(), i.end()) - i.begin() );
84 82
85 -
    std::vector<double> data(i.size());
86 -
    vex::gather<double>  get(ctx, x.size(), i);
87 -
    vex::scatter<double> put(ctx, x.size(), i);
83 +
    for (int sorted = 0; sorted < 2; ++sorted) {
84 +
        if (sorted) {
85 +
            std::sort(i.begin(), i.end());
86 +
            i.resize( std::unique(i.begin(), i.end()) - i.begin() );
87 +
        }
88 88
89 -
    get(X, data);
89 +
        std::vector<double>  data(i.size());
90 +
        vex::gather<double>  get(ctx, x.size(), i);
91 +
        vex::scatter<double> put(ctx, x.size(), i);
90 92
91 -
    for(size_t p = 0; p < i.size(); ++p)
92 -
        BOOST_CHECK(data[p] == x[i[p]]);
93 +
        get(X, data);
93 94
94 -
    X = 0;
95 -
    put(data, X);
95 +
        for(size_t p = 0; p < i.size(); ++p)
96 +
            BOOST_CHECK(data[p] == x[i[p]]);
96 97
97 -
    for(size_t p = 0; p < i.size(); ++p)
98 -
        BOOST_CHECK(data[p] == x[i[p]]);
98 +
        vex::vector<double> Y(ctx, n);
99 +
        Y = 0;
100 +
        put(data, Y);
101 +
102 +
        for(size_t p = 0; p < i.size(); ++p)
103 +
            BOOST_CHECK(Y[i[p]] == x[i[p]]);
104 +
    }
99 105
}
100 106
101 107
BOOST_AUTO_TEST_CASE(std_sort_vex_vector)

@@ -48,41 +48,41 @@
Loading
48 48
    public:
49 49
        index_partition(
50 50
                const std::vector<backend::command_queue> &q,
51 -
                size_t size, std::vector<size_t> &indices
51 +
                size_t size, const std::vector<size_t> &indices
52 52
                )
53 -
            : queue(q), ptr(q.size() + 1, 0),
54 -
              idx(q.size()), val(q.size())
53 +
            : queue(q), ptr(q.size() + 1, 0)
55 54
        {
56 -
            assert(queue.size() == 1 || std::is_sorted(indices.begin(), indices.end()));
55 +
            if (queue.size() > 1 && !std::is_sorted(indices.begin(), indices.end())) {
56 +
                idx.resize(indices.size());
57 +
                ord.resize(indices.size());
58 +
59 +
                std::iota(ord.begin(), ord.end(), 0ul);
60 +
                std::sort(ord.begin(), ord.end(), [&indices](size_t i, size_t j){ return indices[i] < indices[j]; });
61 +
62 +
                std::vector<size_t> I(indices.size());
63 +
                for(size_t i = 0; i < indices.size(); ++i)
64 +
                    idx[i] = indices[ord[i]];
65 +
            } else {
66 +
                idx = indices;
67 +
            }
57 68
58 69
            std::vector<size_t> part = partition(size, queue);
59 70
            column_owner owner(part);
60 71
61 -
            for(auto i = indices.begin(); i != indices.end(); ++i) {
72 +
            for(auto i = idx.begin(); i != idx.end(); ++i) {
62 73
                size_t d = owner(*i);
63 74
                *i -= part[d];
64 75
                ++ptr[d + 1];
65 76
            }
66 77
67 78
            std::partial_sum(ptr.begin(), ptr.end(), ptr.begin());
68 -
69 -
            for(unsigned d = 0; d < queue.size(); d++) {
70 -
                if (size_t n = ptr[d + 1] - ptr[d]) {
71 -
                    val[d] = backend::device_vector<T>(queue[d], n, static_cast<const T*>(0));
72 -
                    idx[d] = backend::device_vector<size_t>(
73 -
                            queue[d], n, &indices[ptr[d]], backend::MEM_READ_ONLY);
74 -
                }
75 -
            }
76 -
77 -
            for(unsigned d = 0; d < queue.size(); d++)
78 -
                if (ptr[d + 1] - ptr[d]) queue[d].finish();
79 79
        }
80 80
81 81
    protected:
82 -
        std::vector<backend::command_queue>           queue;
83 -
        std::vector< size_t >                         ptr;
84 -
        std::vector< backend::device_vector<size_t> > idx;
85 -
        std::vector< backend::device_vector<T> >      val;
82 +
        std::vector<backend::command_queue> queue;
83 +
        std::vector< size_t > ptr;
84 +
        std::vector< size_t > idx;
85 +
        std::vector< size_t > ord;
86 86
};
87 87
88 88
} // namespace detail
@@ -98,7 +98,7 @@
Loading
98 98
         */
99 99
        gather(
100 100
                const std::vector<backend::command_queue> &q,
101 -
                size_t size, std::vector<size_t> indices
101 +
                size_t size, const std::vector<size_t> &indices
102 102
              ) : Base(q, size, indices)
103 103
        {}
104 104
@@ -111,18 +111,17 @@
Loading
111 111
112 112
            for(unsigned d = 0; d < Base::queue.size(); d++) {
113 113
                if (size_t n = Base::ptr[d + 1] - Base::ptr[d]) {
114 -
                    vector<T>      v(Base::queue[d], Base::val[d]);
115 -
                    vector<T>      s(Base::queue[d], src(d));
116 -
                    vector<size_t> i(Base::queue[d], Base::idx[d]);
117 -
118 -
                    v = permutation(i)(s);
119 -
120 -
                    Base::val[d].read(Base::queue[d], 0, n, &dst[Base::ptr[d]]);
114 +
                    auto s = src.map(d);
115 +
116 +
                    if (Base::ord.empty()) {
117 +
                        for(size_t i = Base::ptr[d]; i < Base::ptr[d+1]; ++i)
118 +
                            dst[i] = s[Base::idx[i]];
119 +
                    } else {
120 +
                        for(size_t i = Base::ptr[d]; i < Base::ptr[d+1]; ++i)
121 +
                            dst[Base::ord[i]] = s[Base::idx[i]];
122 +
                    }
121 123
                }
122 124
            }
123 -
124 -
            for(unsigned d = 0; d < Base::queue.size(); d++)
125 -
                if (Base::ptr[d + 1] - Base::ptr[d]) Base::queue[d].finish();
126 125
        }
127 126
    private:
128 127
        typedef detail::index_partition<T> Base;
@@ -139,7 +138,7 @@
Loading
139 138
         */
140 139
        scatter(
141 140
                const std::vector<backend::command_queue> &q,
142 -
                size_t size, std::vector<size_t> indices
141 +
                size_t size, const std::vector<size_t> &indices
143 142
              ) : Base(q, size, indices)
144 143
        {}
145 144
@@ -152,18 +151,16 @@
Loading
152 151
153 152
            for(unsigned d = 0; d < Base::queue.size(); d++) {
154 153
                if (size_t n = Base::ptr[d + 1] - Base::ptr[d]) {
155 -
                    Base::val[d].write(Base::queue[d], 0, n, &src[Base::ptr[d]]);
156 -
157 -
                    vector<T>      v(Base::queue[d], Base::val[d]);
158 -
                    vector<T>      s(Base::queue[d], dst(d));
159 -
                    vector<size_t> i(Base::queue[d], Base::idx[d]);
160 -
161 -
                    permutation(i)(s) = v;
154 +
                    auto v = dst.map(d);
155 +
                    if (Base::ord.empty()) {
156 +
                        for(size_t i = Base::ptr[d]; i < Base::ptr[d+1]; ++i)
157 +
                            v[Base::idx[i]] = src[i];
158 +
                    } else {
159 +
                        for(size_t i = Base::ptr[d]; i < Base::ptr[d+1]; ++i)
160 +
                            v[Base::idx[i]] = src[Base::ord[i]];
161 +
                    }
162 162
                }
163 163
            }
164 -
165 -
            for(unsigned d = 0; d < Base::queue.size(); d++)
166 -
                if (Base::ptr[d + 1] - Base::ptr[d]) Base::queue[d].finish();
167 164
        }
168 165
    private:
169 166
        typedef detail::index_partition<T> Base;

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
tests +<.01% 99.61%
vexcl +<.01% 94.82%
CL/cl.hpp 85.20%
examples/devlist.cpp 94.59%
Project Totals (114 files) 95.37%
Loading