Sha256: 61aa037b5c8504aab69eb25a46fabdb4e787e012a05e6c8b10c1db2c08240604

Contents?: true

Size: 1.61 KB

Versions: 19

Compression:

Stored size: 1.61 KB

Contents

static void
<%=c_iter%>(cumo_na_loop_t *const lp)
{
    ssize_t  i, s1, s2;
    size_t   p1;
    char    *p2;
    size_t  *idx1, *idx2;
    <%=dtype%> x;
    CUMO_BIT_DIGIT *a1;
    CUMO_BIT_DIGIT  y;

    // TODO(sonots): CUDA kernelize
    CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("store_<%=name%>", "<%=type_name%>");
    cumo_cuda_runtime_check_status(cudaDeviceSynchronize());

    CUMO_INIT_COUNTER(lp, i);
    CUMO_INIT_PTR_BIT_IDX(lp, 0, a1, p1, s1, idx1);
    CUMO_INIT_PTR_IDX(lp, 1, p2, s2, idx2);

    if (idx2) {
        if (idx1) {
            for (; i--;) {
                CUMO_GET_DATA_INDEX(p2,idx2,<%=dtype%>,x);
                y = <%=macro%>(x);
                CUMO_STORE_BIT(a1, p1+*idx1, y); idx1++;
            }
        } else {
            for (; i--;) {
                CUMO_GET_DATA_INDEX(p2,idx2,<%=dtype%>,x);
                y = <%=macro%>(x);
                CUMO_STORE_BIT(a1, p1, y); p1+=s1;
            }
        }
    } else {
        if (idx1) {
            for (; i--;) {
                CUMO_GET_DATA_STRIDE(p2,s2,<%=dtype%>,x);
                y = <%=macro%>(x);
                CUMO_STORE_BIT(a1, p1+*idx1, y); idx1++;
            }
        } else {
            for (; i--;) {
                CUMO_GET_DATA_STRIDE(p2,s2,<%=dtype%>,x);
                y = <%=macro%>(x);
                CUMO_STORE_BIT(a1, p1, y); p1+=s1;
            }
        }
    }
}


static VALUE
<%=c_func(:nodef)%>(VALUE self, VALUE obj)
{
    cumo_ndfunc_arg_in_t ain[2] = {{CUMO_OVERWRITE,0},{Qnil,0}};
    cumo_ndfunc_t ndf = {<%=c_iter%>, CUMO_FULL_LOOP, 2,0, ain,0};

    cumo_na_ndloop(&ndf, 2, self, obj);
    return self;
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cumo-0.4.3 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.4.2 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.4.1 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.4.0 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.5 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.4 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.3 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.2 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.1 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.0 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.3.0.pre1 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.2.5 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.2.4 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.2.3 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.2.2 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.2.1 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.2.0 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.1.2 ext/cumo/narray/gen/tmpl_bit/store_from.c
cumo-0.1.1 ext/cumo/narray/gen/tmpl_bit/store_from.c