<commit_before>#include "internal.hpp"
#include <algorithm>
#include "pcl/gpu/utils/safe_call.hpp"


//don't want to include pcl_macros.h as it produces stupid warnings in cu-files because of boost.
#if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__ || __CUDACC__
    #ifdef PCLAPI_EXPORTS
        #define PCL_EXPORTS __declspec(dllexport)
    #else
        #define PCL_EXPORTS
    #endif
#else
    #define PCL_EXPORTS
#endif


namespace pcl
{
    namespace device
    {           
        struct Info
        {
            enum { SIZE = 4 };
            int data[SIZE];
        };

        template<int n>
        struct Point
        {
            int data[n];
        };

        template<int in, int out, typename Info>
        __global__ void deviceCopyFields4B(const Info info, const int size, const void* input, void* output)
        {
            int idx = blockIdx.x * blockDim.x + threadIdx.x;            

            if (idx < size)
            {
                Point<in>  point_in  = reinterpret_cast<const  Point<in>* >( input)[idx];              
                Point<out> point_out = reinterpret_cast<      Point<out>* >(output)[idx];

                for(int i = 0; i < Info::SIZE; ++i)
                {
                    int byte;
                    int code = info.data[i];

                    byte = ((code >> 0) & 0xFF);

                    if (idx == 0 && out == 12)
                        printf("byte1 = %d\n", byte);

                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];

                    byte = ((code >> 8) & 0xFF);

                    if (idx == 0 && out == 12)
                        printf("byte2 = %d\n", byte);

                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];




                    byte = ((code >> 16) & 0xFF);

                    if (idx == 0 && out == 12)
                        printf("byte3 = %d\n", byte);

                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];

                    byte = ((code >> 24) & 0xFF);

                    if (idx == 0 && out == 12)
                        printf("byte4 = %d\n", byte);

                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];
                }

                reinterpret_cast< Point<out>* >(output)[idx] = point_out;
            }          
        };

        template<int in_size, int out_size>
        void cf(int info[4], int size, const void* input, void* output)
        {
            Info i;
            std::copy(info, info + 4, i.data);

            dim3 block(256);
            dim3 grid(divUp(size, block.x));

            deviceCopyFields4B<in_size, out_size><<<grid, block>>>(i, size, input, output);
            cudaSafeCall ( cudaGetLastError () );
            cudaSafeCall (cudaDeviceSynchronize ());
        }

        typedef void (*copy_fields_t)(int info[4], int size, const void* input, void* output);
    }
}

<commit_msg>gpu_utils: removed debugging printfs<commit_after>#include "internal.hpp"
#include <algorithm>
#include "pcl/gpu/utils/safe_call.hpp"


//don't want to include pcl_macros.h as it produces stupid warnings in cu-files because of boost.
#if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__ || __CUDACC__
    #ifdef PCLAPI_EXPORTS
        #define PCL_EXPORTS __declspec(dllexport)
    #else
        #define PCL_EXPORTS
    #endif
#else
    #define PCL_EXPORTS
#endif


namespace pcl
{
    namespace device
    {           
        struct Info
        {
            enum { SIZE = 4 };
            int data[SIZE];
        };

        template<int n>
        struct Point
        {
            int data[n];
        };

        template<int in, int out, typename Info>
        __global__ void deviceCopyFields4B(const Info info, const int size, const void* input, void* output)
        {
            int idx = blockIdx.x * blockDim.x + threadIdx.x;            

            if (idx < size)
            {
                Point<in>  point_in  = reinterpret_cast<const  Point<in>* >( input)[idx];              
                Point<out> point_out = reinterpret_cast<      Point<out>* >(output)[idx];

                for(int i = 0; i < Info::SIZE; ++i)
                {
                    int byte;
                    int code = info.data[i];

                    byte = ((code >> 0) & 0xFF);

                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];

                    byte = ((code >> 8) & 0xFF);

                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];

                    byte = ((code >> 16) & 0xFF);
                    
                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];

                    byte = ((code >> 24) & 0xFF);
                    
                    if (byte == 0xFF)
                        break;
                    else
                        point_out.data[byte >> 4] = point_in.data[byte & 0xF];
                }

                reinterpret_cast< Point<out>* >(output)[idx] = point_out;
            }          
        };

        template<int in_size, int out_size>
        void cf(int info[4], int size, const void* input, void* output)
        {
            Info i;
            std::copy(info, info + 4, i.data);

            dim3 block(256);
            dim3 grid(divUp(size, block.x));

            deviceCopyFields4B<in_size, out_size><<<grid, block>>>(i, size, input, output);
            cudaSafeCall ( cudaGetLastError () );
            cudaSafeCall (cudaDeviceSynchronize ());
        }

        typedef void (*copy_fields_t)(int info[4], int size, const void* input, void* output);
    }
}


{'fraction_non_alphanumeric': 0.1108839257628185, 'fraction_numerical': 0.015099087763447625, 'mean_word_length': 1.22888187872415, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2325676', 'n_tokens_mistral': 1942, 'n_tokens_neox': 1752, 'n_words': 457}