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

Use of undeclared identifier, when summing two axes #559

Open
Baekalfen opened this issue Nov 13, 2018 · 4 comments
Open

Use of undeclared identifier, when summing two axes #559

Baekalfen opened this issue Nov 13, 2018 · 4 comments

Comments

@Baekalfen
Copy link
Contributor

The code below crashes Bohrium. Both sums seem to be required for the crash to occur.

dim = 16
c = np.arange(dim**3, dtype=np.float32).reshape((dim,dim,dim))
k3 = np.sum(c, axis=2)
k4 = np.sum(c, axis=1)

The kernel is simply missing the array in global memory, it tries to write to.

#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#include <kernel_dependencies/complex_opencl.h>
#include <kernel_dependencies/integer_operations.h>

__kernel void execute_9775374476049381469(ulong vo0, ulong vs0_0, ulong vs0_1, ulong vo1, ulong vs1_0, ulong vs1_1, ulong vs1_2, const long c1, const long c2, const float c3, const float c4) {
    // The IDs of the threaded blocks:
    const uint g0 = get_global_id(0); if (g0 >= 16) { return; } // Prevent overflow

    {const ulong i0 = g0;
        for (ulong i1 = 0; i1 < 16; ++i1) {
            const ulong idx0 = (vo0 +i0*vs0_0 +i1*vs0_1);
            a0[idx0] = c4;
        }
        for (ulong i1 = 0; i1 < 16; ++i1) {
            float t1;
            t1 = c3;
            for (ulong i2 = 0; i2 < 16; ++i2) {
                uint t2;
                float t3;
                float t0;
                t2 = (vo1 +i0*vs1_0 +i1*vs1_1 +i2*vs1_2);
                t3 = t2;
                t1 += t3;
                t0 += t3;
            }
        }
    }
}
@Baekalfen
Copy link
Contributor Author

Here is a simpler example. The dimensions and axis seems to play a role.

dim = 50
a = np.arange(dim**4, dtype=np.float32).reshape((dim,dim,dim,dim))
k = np.sum(a, axis=1)

@omegahm
Copy link
Member

omegahm commented Dec 4, 2018

These work fine on my MacBook with Bohrium compiled from master. As a side effect, I print k or k3 and k4. Is this still an issue?

@Baekalfen
Copy link
Contributor Author

I don't have access to my test-machine again before monday. But If I remember correct, the problem disappears when you the print the variables, as this will allocate the arrays in global memory.

@omegahm
Copy link
Member

omegahm commented Dec 6, 2018

Then indeed mine also crash when executing

import bohrium as np
dim = 50
a = np.arange(dim**4, dtype=np.float32).reshape((dim,dim,dim,dim))
k = np.sum(a, axis=1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants