Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7169149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:55:39+00:00 2026-05-28T14:55:39+00:00

To create a opencl application the fist step is to get platforms by using

  • 0

To create a opencl application the fist step is to get platforms by using

clGetPlatformIDs 

I have a problem with the platforms that return from function ;the function return that i have 2 platforms but when i check them i found that i have one platform but it’s duplicated !!

source code

struct PLATFORM
{
    cl_platform_id _Platforms ;
    map <cl_platform_info , char*> _Platforms_info ;        
};

cl_int error ; 
cl_uint temp_num_platforms ;

error = clGetPlatformIDs (NULL , NULL , &temp_num_platforms );

if ( error != CL_SUCCESS )
{
    /* create error and debug function*/
    cout << " error detect platforms " << endl << endl ;
}
else
{
    cout << " we  detect " << temp_num_platforms << " platforms " << endl << endl ;

    _Platforms = std::unique_ptr < PLATFORM [] > ( new PLATFORM [temp_num_platforms] ) ;

    for ( unsigned int num_platforms = 1 ; num_platforms <= temp_num_platforms ; num_platforms++ )
    {   
        // get platforms    
        error = clGetPlatformIDs (num_platforms ,&_Platforms[num_platforms-1]._Platforms , NULL );

        if ( error != CL_SUCCESS || _Platforms[num_platforms-1]._Platforms == NULL )
        {
            cout << " error get platform "  <<  num_platforms - 1 << endl << endl;
        }
        else
        {
            cout << " OK ! we detect "<< num_platforms << " platform " << endl << endl ;
        }
    }
}

if ( _Platforms[0]._Platforms == _Platforms[1]._Platforms )
{
    cout << " we have two platforms" << endl << endl ;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:55:41+00:00Added an answer on May 28, 2026 at 2:55 pm

    You haven’t said much about your installation platform. My guess is that you have installed multiple versions of the OpenCL SDK from some vendor. That, or you’ve hit a bug. Try the program below, which prints out the vendor, name, and version of all the platforms reported on your system. It might help you understand your problem better.

    // You might need to change this header based on your install:
    #include <OpenCL/cl.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    static void check_error(cl_int error, char* name) {
        if (error != CL_SUCCESS) {
            fprintf(stderr, "Non-successful return code %d for %s.  Exiting.\n", error, name);
            exit(1);
        }
    }
    
    int main (int argc, char const *argv[])
    {
        cl_uint i;
        cl_int err;
    
        // Discover the number of platforms:
        cl_uint nplatforms;
        err = clGetPlatformIDs(0, NULL, &nplatforms);
        check_error(err, "clGetPlatformIds");
    
        // Now ask OpenCL for the platform IDs:
        cl_platform_id* platforms = (cl_platform_id*)malloc(sizeof(cl_platform_id) * nplatforms);
        err = clGetPlatformIDs(nplatforms, platforms, NULL);
        check_error(err, "clGetPlatformIds");
    
        // Ask OpenCL about each platform to understand the problem:
        char name[128];
        char vendor[128];
        char version[128];
    
        fprintf(stdout, "OpenCL reports %d platforms.\n\n", nplatforms);
    
        for (i = 0; i < nplatforms; i++) {
            err |= clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, 128, vendor, NULL);
            err |= clGetPlatformInfo(platforms[i], CL_PLATFORM_NAME, 128, name, NULL);
            err |= clGetPlatformInfo(platforms[i], CL_PLATFORM_VERSION, 128, version, NULL);
            check_error(err, "clGetPlatformInfo");
    
            fprintf(stdout, "Platform %d: %s %s %s\n", i, vendor, name, version);
        }
    
        free(platforms);
        return 0;
    }
    

    If you see two identical vendor-name-versions strings, then it’s a bug. File it with your OpenCL vendor, and they’ll thank you!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem I am facing is that I have a glx based application that
I'm using GoblinXNA to create an AR application. I copied EVERYTHING over from Tutorial
guys I want to create an application that has a 3D display. I want
We have to create an application which can take a photograph and can recognize
I've to create a Web Based Application, that amongst other things, includes the following
My iphone application captures the realtime data from camera using AVFoundation's AVCaptureSession. I'm able
I am trying to create an application to capture a snapshot using a webcam.
I have simple console application project for live video streaming using cross-platform libs on
I have been trying to create a hud in my OpenGL application. Having looked
I've written an application for the iPad that I'd now like to get working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.