Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/lib/cl-target/clinfo.c
ViewVC logotype

Diff of /branches/pure-cfg/src/lib/cl-target/clinfo.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1378, Thu Jun 23 01:24:20 2011 UTC revision 1379, Thu Jun 23 14:48:07 2011 UTC
# Line 109  Line 109 
109          CHECK(clGetDeviceInfo (          CHECK(clGetDeviceInfo (
110              devices[i], CL_DEVICE_TYPE, sizeof(cl_device_type), &(dev->ty), 0));              devices[i], CL_DEVICE_TYPE, sizeof(cl_device_type), &(dev->ty), 0));
111          CHECK(clGetDeviceInfo (          CHECK(clGetDeviceInfo (
112                devices[i], CL_DEVICE_AVAILABLE, sizeof(cl_bool), &(dev->isAvail), 0));
113            CHECK(clGetDeviceInfo (
114              devices[i], CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), &(dev->addrBits), 0));              devices[i], CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), &(dev->addrBits), 0));
115          CHECK(clGetDeviceInfo (          CHECK(clGetDeviceInfo (
116              devices[i], CL_DEVICE_ENDIAN_LITTLE, sizeof(cl_bool), &(dev->littleEndian), 0));              devices[i], CL_DEVICE_ENDIAN_LITTLE, sizeof(cl_bool), &(dev->littleEndian), 0));
# Line 119  Line 121 
121          CHECK(clGetDeviceInfo (          CHECK(clGetDeviceInfo (
122              devices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &(dev->maxWGSize), 0));              devices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &(dev->maxWGSize), 0));
123          size_t szb = sizeof(size_t) * dev->maxWIDims;          size_t szb = sizeof(size_t) * dev->maxWIDims;
124          dev->maxWISize = (size_t *) malloc (szb);          dev->maxWISize = (size_t *) alloc (szb);
125          CHECK(clGetDeviceInfo (devices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, szb, dev->maxWISize, 0));          CHECK(clGetDeviceInfo (devices[i], CL_DEVICE_MAX_WORK_ITEM_SIZES, szb, dev->maxWISize, 0));
126          CHECK(clGetDeviceInfo (          CHECK(clGetDeviceInfo (
127              devices[i], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), &(dev->globalMemSzb), 0));              devices[i], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(cl_ulong), &(dev->globalMemSzb), 0));
128          CHECK(clGetDeviceInfo (          CHECK(clGetDeviceInfo (
# Line 148  Line 150 
150          }          }
151      }      }
152    
153        free(devices);
154    
155      return true;      return true;
156  }  }
157    
158    void PrintCLInfo (FILE *outS, CLInfo_t *clinfo)
159    {
160        if (clinfo->numPlatforms == 0) {
161            fprintf(outS, "No OpenCL platforms\n");
162            return;
163        }
164    
165        fprintf(outS, "OpenCL profile:\n");
166        for (int i = 0;  i < clinfo->numPlatforms;  i++) {
167            PlatformInfo_t *plat = &(clinfo->platforms[i]);
168            fprintf (outS, "  Platform %d (%s)\n", i, plat->name);
169            for (int j = 0;  j < plat->numDevices;  j++) {
170                DeviceInfo_t *dev = &(plat->devices[j]);
171                if (dev->isAvail)
172                    fprintf (outS, "    Device %d.%d (%s):\n", i, j, dev->name);
173                else
174                    fprintf (outS, "    Device %d.%d (%s): **UNAVAILABLE**\n", i, j, dev->name);
175                fprintf (outS, "      Type:                 %s\n",
176                    isGPUDevice(dev) ? "GPU" : isCPUDevice(dev) ? "CPU" : "UNKNOWN");
177                fprintf (outS, "      Address size:         %d\n", dev->addrBits);
178                fprintf (outS, "      Endianess:            %s\n", dev->littleEndian ? "LITTLE" : "BIG");
179                fprintf (outS, "      Num. compute units:   %d\n", dev->numCUs);
180                fprintf (outS, "      Max. dimensions:      %d\n", dev->maxWIDims);
181                fprintf (outS, "      Max. work group size: %ld\n", (long)(dev->maxWGSize));
182                fprintf (outS, "      Max. work items:      ");
183                for (int k = 0;  k < dev->maxWIDims;  k++)
184                    fprintf (outS, "%s%ld", (k > 0) ? " x " : "", (long)(dev->maxWISize[k]));
185                fprintf (outS, "\n");
186                fprintf (outS, "      Global memory size:   %ld\n", (long)(dev->globalMemSzb));
187                fprintf (outS, "      Local memory size:    %ld\n", (long)(dev->localMemSzb));
188                fprintf (outS, "      Max. allocation size: %ld\n", (long)(dev->maxAllocSzb));
189                fprintf (outS, "      Max. 2D image size:   %ld x %ld\n",
190                    (long)(dev->maxImg2D[0]), (long)(dev->maxImg2D[1]));
191                fprintf (outS, "      Max. 3D image size:   %ld x %ld x %ld\n",
192                    (long)(dev->maxImg3D[0]), (long)(dev->maxImg3D[1]), (long)(dev->maxImg3D[2]));
193            }
194        }
195    
196    }

Legend:
Removed from v.1378  
changed lines
  Added in v.1379

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0