 #include "debug_macros.h"
 #include "assist.h"
 #include <cuda_runtime.h>
+#include <curand_mtgp32_kernel.h>
+#include <device_launch_parameters.h>
 
 /*************************************************************
  * V11: device side


#define V11_EDGE_LEN 32
#define V11_RANGE    4 // RANGES from 1 to 8 are possible
#define V11_LEVELS   _levels

namespace popart {


         << "    original pix size : " << base->u_width/base->type_size << "x" << base->u_height << endl;
#endif // (PYRAMID_PRINT_DEBUG==1)

#if 0
    Plane2D_float** imagus = new Plane2D_float*[_num_octaves];
    for(int i=0;i<_num_octaves;i++){
        imagus[i] = new Plane2D_float[_levels];
    }

    for(uint32_t octave=0; octave<_num_octaves; octave++){

        const int width  = _octaves[octave].getData(0).getWidth();
        const int height = _octaves[octave].getData(0).getHeight();
        dim3 h_block( 64, 2 );
        dim3 h_grid;

        h_grid.x = (unsigned int)grid_divide( width,  h_block.x );
        h_grid.y = (unsigned int)grid_divide( height, h_block.y );

        dim3 v_block( 64, 2 );
        dim3 v_grid;
        v_grid.x = (unsigned int)grid_divide( width,  v_block.x );
        v_grid.y = (unsigned int)grid_divide( height, v_block.y );

        dim3 d_block( 32, 1 );
        dim3 d_grid;
        d_grid.x = (unsigned int)grid_divide( width,  d_block.x );
        d_grid.y = (unsigned int)grid_divide( height, d_block.y );


        if(octave==0){
            imagus[octave][0] = base->array;
        }else{
            imagus[octave][0] = _octaves[octave].getData(0);
        }

        for(uint32_t level=0; level<_levels; level++){
            filter_gauss_horiz_v11_by_2 <<<h_grid,h_block>>> (
                _octaves[octave-1]._data_tex[ _levels-3 ],
                _octaves[octave].getIntermediateData( ) );


        }
    }
#endif

    for( uint32_t octave=0; octave<_num_octaves; octave++ ) {
        for( uint32_t level=0; level<_levels; level++ ) {
#if 0
        cerr << "Configuration for octave " << octave << endl
             << "  Horiz: layer size: "
