3 Replies Latest reply on Jan 27, 2014 1:10 AM by jaidotsh

    does bolt(opencl) support custom user type "BigInteger"?

    allenwaye

      Hell there,

      my app uses "BigInteger" for MP seeking, the Fuctor uses "BigInteger", all the codes work on CPUs, however the DebugLog not working, the IntelTBB not working, after i tried the configurations and online tutorial many times, when i switch to GPU, the underlying opencl didn't not support "BigInterger", is there any way the bolt will make opencl support custom user type?

       

      code snippet for example:

      #include "stdafx.h"

      #include "BigIntegerLibrary.hh"

      #include <bolt/cl/transform.h>

      #include <bolt/cl/device_vector.h>

      #include <bolt/statisticalTimer.h>

      #define BOLT_DEBUG_LOG

      #include "bolt/BoltLog.h"

      using namespace std;

      BOLT_FUNCTOR(IntFunctor,

      struct IntFunctor

      {

          BigInteger operator() (const BigInteger& in)

          {

              return in * in;

          };

      };

      );

      BOLT_CREATE_TYPENAME(BigInteger);

      BOLT_TEMPLATE_REGISTER_NEW_ITERATOR( bolt::cl::device_vector, int, BigInteger);

      main()

      {

      BOLTLOG::CaptureLog *xyz =  BOLTLOG::CaptureLog::getInstance();

        xyz->Initialize();

        std::vector< BOLTLOG::FunPaths> paths;

        bolt::cl::control ctl = bolt::cl::control::getDefault( );

        //ctl.setForceRunMode( bolt::cl::control::MultiCoreCpu );

        vector<BigInteger> inputInt(5);

        for(int i = 0; i< inputInt.size();++i)

        {

        inputInt[i] = BigInteger(i+1);

        }

        vector<BigInteger> outputInt(5);

        bolt::cl::transform(inputInt.begin(), inputInt.end(), outputInt.begin(),IntFunctor());

       

      xyz->WhatPathTaken(paths);

        for(std::vector< BOLTLOG::FunPaths>::iterator parse=paths.begin(); parse!=paths.end(); parse++)

        {

        std::cout<<(*parse).fun<<"\n";  // prints function number as defined in Boltlog.h

        std::cout<<(*parse).path<<"\n";  // prints the path number – 0 for Multicore TBB, 1 for OpenCL™ GPU, 2 for OpenCL™ CPU and 3 for Serial.

        std::cout<<(*parse).msg<<"\n";  // prints the Path taken

        }

        cout<<"\nfinished";

      }