Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

DPCT Error on matching constructors to variables

FARSHAD_A_Intel
Employee
1,151 Views

Hello,

I wonder the case I am seeing is a DPCT limitation as there is no issue with NVCC. Essentially, I see that DPCT is having issue with complex data types.  In below code snipped, I get an error described as below:

: error: no matching constructor for initialization of 'hpmc::hpmc_counters_t'
hpmc_counters_t result;

 

Any guidance as how to get this code through DPCT?

================================================

here is the code causing above error:

struct hpmc_counters_t
    {
    unsigned long long int translate_accept_count;      //!< Count of accepted translation moves
    unsigned long long int translate_reject_count;      //!< Count of rejected translation moves
    unsigned long long int rotate_accept_count;         //!< Count of accepted rotation moves
    unsigned long long int rotate_reject_count;         //!< Count of rejected rotation moves
    unsigned long long int overlap_checks;              //!< Count of the number of overlap checks
    unsigned int overlap_err_count;                     //!< Count of the number of times overlap checks encounter errors

    //! Construct a zero set of counters
    hpmc_counters_t()
        {
        translate_accept_count = 0;
        translate_reject_count = 0;
        rotate_accept_count = 0;
        rotate_reject_count = 0;
        overlap_checks = 0;
        overlap_err_count = 0;
        }

    //! Get the translate acceptance
    /*! \returns The ratio of translation moves that are accepted, or 0 if there are no translation moves
    */
    DEVICE double getTranslateAcceptance()
        {
        if (translate_reject_count + translate_accept_count == 0)
            return 0.0;
        else
            return double(translate_accept_count) / double(translate_reject_count + translate_accept_count);
        }

    //! Get the rotate acceptance
    /*! \returns The ratio of rotation moves that are accepted, or 0 if there are no rotation moves
    */
    DEVICE double getRotateAcceptance()
        {
        if (rotate_reject_count + rotate_accept_count == 0)
            return 0.0;
        else
            return double(rotate_accept_count) / double(rotate_reject_count + rotate_accept_count);
        }

    //! Get the number of moves
    /*! \return The total number of moves
    */
    DEVICE unsigned long long int getNMoves()
        {
        return translate_accept_count + translate_reject_count + rotate_accept_count + rotate_reject_count;
        }
    };
 
 
//! Take the difference of two sets of counters
DEVICE inline hpmc_counters_t operator-(const hpmc_counters_t& aconst hpmc_counters_t& b)
    {
    hpmc_counters_t result;
    result.translate_accept_count = a.translate_accept_count - b.translate_accept_count;
    result.rotate_accept_count = a.rotate_accept_count - b.rotate_accept_count;
    result.translate_reject_count = a.translate_reject_count - b.translate_reject_count;
    result.rotate_reject_count = a.rotate_reject_count - b.rotate_reject_count;
    result.overlap_checks = a.overlap_checks - b.overlap_checks;
    result.overlap_err_count = a.overlap_err_count - b.overlap_err_count;
    return result;
    }
 
 
0 Kudos
6 Replies
RahulV_intel
Moderator
1,142 Views

Hi,


Could you attach the complete source code of the files that you are trying to migrate?


I will try to reproduce this issue from my end and get back to you.



Thanks,

Rahul


0 Kudos
FARSHAD_A_Intel
Employee
1,138 Views
It may not be an easy thing to do due to nested dependencies spreading through multiple libraries. I will try to isolate the issue. But one question: I read somewhere that DPCT is not supporting inline functions. Is that true? Because this is an in-line function here.
0 Kudos
RahulV_intel
Moderator
1,135 Views

Hi,


Yes, that would be helpful.


For inline functions, can you give it a try by providing this extra flag during DPCT migration: --extra-arg="-std=c++17"



Thanks,

Rahul


0 Kudos
RahulV_intel
Moderator
1,105 Views

Hi,


Just a quick reminder to attach a small reproducer for your issue.


Thanks,

Rahul


0 Kudos
FARSHAD_A_Intel
Employee
1,102 Views

Hi Rahul,

 

this turned out not to be an easy task. There are more than 20,000 errors I had to navigate through to create a test case. I have tabled this and will come back to it later. you can unfollow this issue for now.

thanks

Farshad.

0 Kudos
RahulV_intel
Moderator
1,087 Views

Hi,


As per your request, I'll go ahead and close this thread from my end. Post a new question once you have the reproducer ready.


Thanks,

Rahul


0 Kudos
Reply