copperhead
copperhead copied to clipboard
compile errors in test_zip.py
Hi I get a compile error on the tests/test_zip.py test
/usr/lib/python2.7/site-packages/copperhead-0.2a2-py2.7.egg/copperhead/inc/prelude/basic/apply_from_tuple.h(44): error: function "_shift_zip_5092476690532980926::fn_shift_el<a>::operator() [with a=thrust::tuple<long, long, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>]" cannot be called with the given argument list
argument types are: (const long, const thrust::tuple<long, long, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, const long, const copperhead::zipped_sequence<thrust::tuple<copperhead::sequence<copperhead::cuda_tag, long, 0>, copperhead::sequence<copperhead::cuda_tag, long, 0>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>)
object type is: _shift_zip_5092476690532980926::fn_shift_el<thrust::tuple<long, long, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>
This happens at the second phase_boundary of the generated Cuda code:
#include <prelude/prelude.h>
#include <prelude/runtime/cunp.hpp>
#include <prelude/runtime/make_cuarray.hpp>
#include <prelude/runtime/make_sequence.hpp>
#include <prelude/runtime/tuple_utilities.hpp>
using namespace copperhead;
#include "prelude/primitives/indices.h"
#include "prelude/primitives/map.h"
#include "prelude/primitives/zip.h"
namespace _shift_zip_5092476690532980926 {
template<typename a>
__device__ a _shift_el(long _i, a _K0, long _K1, sequence<cuda_tag, a> _K2) {
typedef long T_i;
typedef a T_K0;
typedef long T_K1;
typedef sequence<cuda_tag, a> T_K2;
typedef long T_i_1;
T_i_1 _i_1 = op_add(_i, _K1);
typedef long Te4;
Te4 e4 = cast_to((long)0, _i_1);
typedef bool Te0;
Te0 e0 = cmp_lt(_i_1, e4);
typedef long Te1;
Te1 e1 = len(_K2);
typedef bool Te2;
Te2 e2 = cmp_ge(_i_1, e1);
if (op_bor(e0, e2)) {
return _K0;
} else {
typedef a Tresult;
Tresult result = _K2[_i_1];
return result;
}
}
template<typename a>
struct fn_shift_el {
typedef a result_type;
__device__ a operator()(long _i, a _K0, long _K1, sequence<cuda_tag, a> _K2) {
typedef long T_i;
typedef a T_K0;
typedef long T_K1;
typedef sequence<cuda_tag, a> T_K2;
return _shift_el(_i, _K0, _K1, _K2);
}
};
sp_cuarray _shift_zip(sp_cuarray ary_x, sp_cuarray ary_y, PyObject* arg0, PyObject* arg1) {
thrust::tuple<long, long> _z = unpack_tuple<thrust::tuple<long, long> >(arg0);
long _d = unpack_scalar_long(arg1);
typedef sp_cuarray Tary_x;
typedef sp_cuarray Tary_y;
typedef thrust::tuple<long, long> T_z;
typedef long T_d;
typedef sequence<cuda_tag, long> T_x;
T_x _x = make_sequence<sequence<cuda_tag, long> >(ary_x, cuda_tag(), false);
typedef sequence<cuda_tag, long> T_y;
T_y _y = make_sequence<sequence<cuda_tag, long> >(ary_y, cuda_tag(), false);
typedef zipped_sequence<thrust::tuple<T_x, T_y> > T_a_2;
T_a_2 _a_2 = zip2(_x, _y);
typedef index_sequence<cuda_tag> Te3_4;
Te3_4 e3_4 = indices(_a_2);
typedef sp_cuarray Tarycomp_a_2;
Tarycomp_a_2 arycomp_a_2 = phase_boundary(_a_2);
typedef zipped_sequence<thrust::tuple<sequence<cuda_tag, long>, sequence<cuda_tag, long> > > Tcomp_a_2;
Tcomp_a_2 comp_a_2 = make_sequence<zipped_sequence<thrust::tuple<sequence<cuda_tag, long>, sequence<cuda_tag, long> > > >(arycomp_a_2, cuda_tag(), true);
typedef transformed_sequence<closure<fn_shift_el<thrust::tuple<long, long> > , thrust::tuple<T_z, T_d, Tcomp_a_2> >, thrust::tuple<Te3_4> > T_b_3;
T_b_3 _b_3 = map1(closure<fn_shift_el<thrust::tuple<long, long> >, thrust::tuple<T_z, T_d, Tcomp_a_2> >(fn_shift_el<thrust::tuple<long, long> >(), thrust::make_tuple(_z, _d, comp_a_2)), e3_4);
typedef sp_cuarray Tarycomp_b_3;
Tarycomp_b_3 arycomp_b_3 = phase_boundary(_b_3); // HERE
typedef zipped_sequence<thrust::tuple<sequence<cuda_tag, long>, sequence<cuda_tag, long> > > Tcomp_b_3;
return arycomp_b_3;
}
}
As I am not very fluent with C++ templates and thrust, could somebody help me to interpret and fix the error?
Thanks Andrea