mirror of https://github.com/silx-kit/pyFAI.git
parent
802d8a254a
commit
c3d9d00141
|
@ -127,16 +127,17 @@ void ocl::ContructorInit()
|
|||
|
||||
reset_time();
|
||||
|
||||
sgs = new az_argtype;
|
||||
oclconfig = new ocl_config_type;
|
||||
ocl_tools_initialise(oclconfig);
|
||||
|
||||
sgs = new az_argtype;
|
||||
sgs->Nx = 0;
|
||||
sgs->Nimage = 0;
|
||||
sgs->Nbins = 0;
|
||||
sgs->Nbinst = 0;
|
||||
sgs->Nbinsc = 0;
|
||||
sgs->usefp64 = 0;
|
||||
|
||||
docstr = new char[8192];
|
||||
|
||||
}
|
||||
|
@ -173,6 +174,17 @@ return std::make_pair(oclconfig->platfid, oclconfig->devid);
|
|||
|
||||
/**
|
||||
* \brief Prints some basic information about the device in use
|
||||
*
|
||||
* The following platform information is displayed:
|
||||
* Name, Version, Vendor and Extensions
|
||||
* Similarily for the device:
|
||||
* Name, Type, Version, Driver version, Extensions and Global memory
|
||||
* To datafields are also accessible externally by platform_info and
|
||||
* device_info structs (not oclconfig->_info!. oclconfig is protected)
|
||||
*
|
||||
* @param ignoreStream Integer flag that tells the function to
|
||||
* ignore any active output stream (stdout or not)
|
||||
* and redirect output to display
|
||||
*/
|
||||
void ocl::show_device_details(int ignoreStream){
|
||||
|
||||
|
@ -194,25 +206,30 @@ void ocl::show_device_details(int ignoreStream){
|
|||
if(ignoreStream) tmp = stdout;
|
||||
else tmp = stream;
|
||||
|
||||
fprintf(tmp,"%s Platform name: %s\n", heading.c_str(), platform_info.name);
|
||||
fprintf(tmp,"%s Platform version: %s\n", heading.c_str(), platform_info.version);
|
||||
fprintf(tmp,"%s Platform vendor: %s\n", heading.c_str(), platform_info.vendor);
|
||||
fprintf(tmp,"%s Platform extensions: %s\n", heading.c_str(), platform_info.extensions);
|
||||
fprintf(tmp,"%s Platform name: %s\n", heading.c_str(), oclconfig->platform_info.name);
|
||||
fprintf(tmp,"%s Platform version: %s\n", heading.c_str(), oclconfig->platform_info.version);
|
||||
fprintf(tmp,"%s Platform vendor: %s\n", heading.c_str(), oclconfig->platform_info.vendor);
|
||||
fprintf(tmp,"%s Platform extensions: %s\n", heading.c_str(), oclconfig->platform_info.extensions);
|
||||
|
||||
fprintf(tmp,"\n");
|
||||
|
||||
fprintf(tmp,"%s Device name: %s\n", heading.c_str(), device_info.name);
|
||||
fprintf(tmp,"%s Device type: %s\n", heading.c_str(), device_info.type);
|
||||
fprintf(tmp,"%s Device version: %s\n", heading.c_str(), device_info.version);
|
||||
fprintf(tmp,"%s Device driver version: %s\n", heading.c_str(), device_info.driver_version);
|
||||
fprintf(tmp,"%s Device extensions: %s\n", heading.c_str(), device_info.extensions);
|
||||
fprintf(tmp,"%s Device Max Memory: %ul\n", heading.c_str(), device_info.global_mem);
|
||||
fprintf(tmp,"%s Device name: %s\n", heading.c_str(), oclconfig->device_info.name);
|
||||
fprintf(tmp,"%s Device type: %s\n", heading.c_str(), oclconfig->device_info.type);
|
||||
fprintf(tmp,"%s Device version: %s\n", heading.c_str(), oclconfig->device_info.version);
|
||||
fprintf(tmp,"%s Device driver version: %s\n", heading.c_str(), oclconfig->device_info.driver_version);
|
||||
fprintf(tmp,"%s Device extensions: %s\n", heading.c_str(), oclconfig->device_info.extensions);
|
||||
fprintf(tmp,"%s Device Max Memory: %ul\n", heading.c_str(), oclconfig->device_info.global_mem);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Makes platform and device info datafields visible to external callers
|
||||
*
|
||||
* Promote_device_details() is called after each successfull context creation by an
|
||||
* init() function. It copies the internal info structures to the public
|
||||
* platform_info and device_info.
|
||||
*
|
||||
*/
|
||||
void ocl::promote_device_details()
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#pragma warning(disable : 4996)
|
||||
//This is required for OpenCL callbacks in windows.
|
||||
//This can also be achieved by setting cl.exe flags.
|
||||
// flag /Gz uses the __stdcall calling convention
|
||||
#define __call_compat __stdcall
|
||||
|
@ -63,6 +64,13 @@
|
|||
#define C CL_CHECK_PR ///Short for CL_CHECK_PR
|
||||
#define CL CL_CHECK_PR_RET ///short for CL_CHECK_PR_RET
|
||||
|
||||
/**
|
||||
* Sets some data members of oclconfig to a default value.
|
||||
* Calls ocl_platform_info_init() and ocl_device_info_init()
|
||||
*
|
||||
* @param oclconfig The OpenCL configuration to be initialised
|
||||
* @return void
|
||||
*/
|
||||
void ocl_tools_initialise(ocl_config_type *oclconfig)
|
||||
{
|
||||
oclconfig->platfid = -1;
|
||||
|
@ -77,6 +85,14 @@ void ocl_tools_initialise(ocl_config_type *oclconfig)
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls ocl_platform_info_del() and ocl_device_info_del().
|
||||
* Other data members are cleaned internally when appropriate by
|
||||
* other calls.
|
||||
*
|
||||
* @param oclconfig The OpenCL configuration to be initialised
|
||||
* @return void
|
||||
*/
|
||||
void ocl_tools_destroy(ocl_config_type *oclconfig)
|
||||
{
|
||||
//Deallocate memory
|
||||
|
|
|
@ -90,7 +90,6 @@ typedef struct
|
|||
{
|
||||
char *name;
|
||||
char type[4];
|
||||
char *refcount;
|
||||
char *version;
|
||||
char *driver_version;
|
||||
char *extensions;
|
||||
|
@ -158,7 +157,14 @@ typedef struct ocl_configuration_parameters{
|
|||
when an error is encountered internally, it will print the message to stderr and fallback.
|
||||
It is important for the user to decide how to continue.*/
|
||||
|
||||
/**
|
||||
* \brief Initialises the internals of an ocl_config_type
|
||||
*/
|
||||
void ocl_tools_initialise(ocl_config_type *oclconfig);
|
||||
|
||||
/**
|
||||
* \brief Deallocations inside ocl_config_type
|
||||
*/
|
||||
void ocl_tools_destroy(ocl_config_type *oclconfig);
|
||||
|
||||
/**
|
||||
|
@ -274,12 +280,34 @@ float ocl_get_profT(cl_event *start, cl_event *stop);
|
|||
*/
|
||||
int ocl_string_to_cldevtype(const char *devicetype, cl_device_type &ocldevtype);
|
||||
|
||||
/**
|
||||
* \brief Initialise an ocl_plat_t struct
|
||||
*/
|
||||
void ocl_platform_info_init(ocl_plat_t &platinfo);
|
||||
|
||||
/**
|
||||
* \brief Release the memory held by the strings inside an ocl_plat_t struct
|
||||
*/
|
||||
void ocl_platform_info_del(ocl_plat_t &platinfo);
|
||||
|
||||
/**
|
||||
* \brief Initialise an ocl_dev_t struct
|
||||
*/
|
||||
void ocl_device_info_init(ocl_dev_t &devinfo);
|
||||
|
||||
/**
|
||||
* \brief Release the memory held by the strings inside an ocl_dev_t struct
|
||||
*/
|
||||
void ocl_device_info_del(ocl_dev_t &devinfo);
|
||||
|
||||
/**
|
||||
* \brief Populates an ocl_plat_t struct
|
||||
*/
|
||||
int ocl_current_platform_info(ocl_config_type *oclconfig);
|
||||
|
||||
/**
|
||||
* \brief Populates an ocl_dev_t struct
|
||||
*/
|
||||
int ocl_current_device_info(ocl_config_type *oclconfig);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue