[clfft] 32/64: Added a device selection feature for the client app.

Jérôme Kieffer kieffer-guest at moszumanska.debian.org
Wed May 20 07:33:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

kieffer-guest pushed a commit to branch develop
in repository clfft.

commit 8fc96b315821c53c3d1bbd0c9ff4ff1f625d5508
Author: Philipp Sibler <philipp.sibler at web.de>
Date:   Wed Mar 11 22:54:38 2015 +0100

    Added a device selection feature for the client app.
---
 src/client/client.cpp        |  36 +++----
 src/client/openCL.misc.cpp   | 220 ++++++++++++++++++++++---------------------
 src/client/openCL.misc.h     |  39 +++++++-
 src/tests/cl_transform.h     |   2 +-
 src/tests/gtest_main.cpp     |   5 +-
 src/tests/test_constants.cpp |   2 +-
 src/tests/test_constants.h   |   1 +
 src/tests/unit_test.cpp      |   4 +-
 8 files changed, 179 insertions(+), 130 deletions(-)

diff --git a/src/client/client.cpp b/src/client/client.cpp
index be9698e..ef55afd 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -47,7 +47,7 @@ template < typename T >
 int transform( size_t* lengths, const size_t *inStrides, const size_t *outStrides, size_t batch_size,
 				clfftLayout in_layout, clfftLayout out_layout,
 				clfftResultLocation place, clfftPrecision precision, clfftDirection dir,
-				cl_device_type deviceType, cl_uint deviceGpuList, bool printInfo,
+				cl_device_type deviceType, cl_int deviceId, bool printInfo,
 				cl_uint command_queue_flags, cl_uint profile_count,
 				std::auto_ptr< clfftSetupData > setupData )
 {
@@ -168,7 +168,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride
 			//	This call creates our openCL context and sets up our devices; expected to throw on error
 			size_of_input_buffers_in_bytes = fftBatchSize * sizeof( std::complex< T > );
 
-			device_id = initializeCL( deviceType, deviceGpuList, context, printInfo );
+			device_id = initializeCL( deviceType, deviceId, context, printInfo );
 			createOpenCLCommandQueue( context,
 				command_queue_flags, queue,
 				device_id,
@@ -214,7 +214,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride
 			//	This call creates our openCL context and sets up our devices; expected to throw on error
 			size_of_input_buffers_in_bytes = fftBatchSize * sizeof( T );
 
-			device_id = initializeCL( deviceType, deviceGpuList, context, printInfo );
+			device_id = initializeCL( deviceType, deviceId, context, printInfo );
 			createOpenCLCommandQueue( context,
 				command_queue_flags, queue,
 				device_id,
@@ -264,7 +264,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride
 			//	This call creates our openCL context and sets up our devices; expected to throw on error
 			size_of_input_buffers_in_bytes = fftBatchSize * sizeof( std::complex< T > );
 
-			device_id = initializeCL( deviceType, deviceGpuList, context, printInfo );
+			device_id = initializeCL( deviceType, deviceId, context, printInfo );
 			createOpenCLCommandQueue( context,
 				command_queue_flags, queue,
 				device_id,
@@ -298,7 +298,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride
 			//	This call creates our openCL context and sets up our devices; expected to throw on error
 			size_of_input_buffers_in_bytes = fftBatchSize * sizeof( T );
 
-			device_id = initializeCL( deviceType, deviceGpuList, context, printInfo );
+			device_id = initializeCL( deviceType, deviceId, context, printInfo );
 			createOpenCLCommandQueue( context,
 				command_queue_flags, queue,
 				device_id,
@@ -337,7 +337,7 @@ int transform( size_t* lengths, const size_t *inStrides, const size_t *outStride
 			//	This call creates our openCL context and sets up our devices; expected to throw on error
 			size_of_input_buffers_in_bytes = fftBatchSize * sizeof( T );
 
-			device_id = initializeCL( deviceType, deviceGpuList, context, printInfo );
+			device_id = initializeCL( deviceType, deviceId, context, printInfo );
 			createOpenCLCommandQueue( context,
 				command_queue_flags, queue,
 				device_id,
@@ -751,9 +751,9 @@ int _tmain( int argc, _TCHAR* argv[] )
 
 #endif /* MEMORYREPORT */
 
-	//	OpenCL state
-	cl_device_type		deviceType	= CL_DEVICE_TYPE_DEFAULT;
-	cl_uint				deviceGpuList     = 0;	// a bitmap set
+	//	OpenCL state 
+	cl_device_type		deviceType	= CL_DEVICE_TYPE_ALL;
+	cl_int				deviceId = -1;
 
 	//	FFT state
 
@@ -784,9 +784,10 @@ int _tmain( int argc, _TCHAR* argv[] )
 			( "help,h",        "produces this help message" )
 			( "version,v",     "Print queryable version information from the clFFT library" )
 			( "clInfo,i",      "Print queryable information of the OpenCL runtime" )
-			( "gpu,g",         "Force instantiation of an OpenCL GPU device" )
-			( "cpu,c",         "Force instantiation of an OpenCL CPU device" )
-			( "all,a",         "Force instantiation of all OpenCL devices" )
+			( "gpu,g",         "Force selection of OpenCL GPU devices only" )
+			( "cpu,c",         "Force selection of OpenCL CPU devices only" )
+			( "all,a",         "Force selection of all OpenCL devices (default)" )
+			( "device",        po::value< cl_int >( &deviceId )->default_value( -1 ),   "Force selection of a specific OpenCL device id as it is reported by clInfo" )
 			( "outPlace,o",    "Out of place FFT transform (default: in place)" )
 			( "double",		   "Double precision transform (default: single)" )
 			( "inv",			"Backward transform (default: forward)" )
@@ -841,16 +842,15 @@ int _tmain( int argc, _TCHAR* argv[] )
 			| ((vm.count( "all" ) > 0) ? 4 : 0);
 		if ((mutex & (mutex-1)) != 0) {
 			terr << _T("You have selected mutually-exclusive OpenCL device options:") << std::endl;
-			if (vm.count ( "gpu" )  > 0) terr << _T("    gpu,g   Force instantiation of an OpenCL GPU device" ) << std::endl;
-			if (vm.count ( "cpu" )  > 0) terr << _T("    cpu,c   Force instantiation of an OpenCL CPU device" ) << std::endl;
-			if (vm.count ( "all" )  > 0) terr << _T("    all,a   Force instantiation of all OpenCL devices" ) << std::endl;
+			if (vm.count ( "gpu" )  > 0) terr << _T("    gpu,g   Force selection of OpenCL GPU devices only" ) << std::endl;
+			if (vm.count ( "cpu" )  > 0) terr << _T("    cpu,c   Force selection of OpenCL CPU devices only" ) << std::endl;
+			if (vm.count ( "all" )  > 0) terr << _T("    all,a   Force selection of all OpenCL devices (default)" ) << std::endl;
 			return 1;
 		}
 
 		if( vm.count( "gpu" ) )
 		{
 			deviceType	= CL_DEVICE_TYPE_GPU;
-			deviceGpuList = ~0;
 		}
 
 		if( vm.count( "cpu" ) )
@@ -972,9 +972,9 @@ int _tmain( int argc, _TCHAR* argv[] )
 		}
 
 		if( precision == CLFFT_SINGLE )
-			transform<float>( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceGpuList, printInfo, command_queue_flags, profile_count, setupData );
+			transform<float>( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceId, printInfo, command_queue_flags, profile_count, setupData );
 		else
-			transform<double>( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceGpuList, printInfo, command_queue_flags, profile_count, setupData );
+			transform<double>( lengths, iStrides, oStrides, batchSize, inLayout, outLayout, place, precision, dir, deviceType, deviceId, printInfo, command_queue_flags, profile_count, setupData );
 	}
 	catch( std::exception& e )
 	{
diff --git a/src/client/openCL.misc.cpp b/src/client/openCL.misc.cpp
index 6bbdec3..aa1c7af 100644
--- a/src/client/openCL.misc.cpp
+++ b/src/client/openCL.misc.cpp
@@ -27,6 +27,8 @@
 #include "clFFT.h"
 #include "openCL.misc.h"
 
+
+
 void prettyPrintPlatformInfo( const cl_platform_id& pId )
 {
 	size_t platformProfileSize	= 0;
@@ -209,6 +211,26 @@ void prettyPrintDeviceInfo( const cl_device_id& dId )
 	std::cout << std::right << std::endl;
 }
 
+void prettyPrintCLPlatforms(std::vector< cl_platform_id >& platforms,
+	std::vector< std::vector< cl_device_id > >& devices)
+{
+	unsigned int devNo = 0;
+	
+	for (unsigned int i = 0; i < platforms.size(); ++i)
+	{
+		std::cout << "OpenCL platform [ " << i << " ]:" << std::endl;
+		prettyPrintPlatformInfo(platforms[i]);
+
+		for (unsigned int n = 0; n < devices[i].size(); ++n)
+		{
+			std::cout << "OpenCL platform [ " << i << " ], device [ " << devNo << " ]:" << std::endl;
+			prettyPrintDeviceInfo((devices[i])[n]);
+			devNo++;
+		}
+	}
+
+}
+
 //	Verify a failed condition; return true on fail
 inline cl_bool OPENCL_V_FAIL( cl_int res )
 {
@@ -332,143 +354,129 @@ std::string prettyPrintclFFTStatus( const cl_int& status )
 	}
 }
 
-std::vector< cl_device_id > initializeCL( cl_device_type deviceType,
-										  cl_uint deviceGpuList,
-										  cl_context& context,
-										  bool printclInfo )
+int discoverCLPlatforms( cl_device_type deviceType,
+						 std::vector< cl_platform_id >& platforms,
+						 std::vector< std::vector< cl_device_id > >& devices )
 {
 	cl_int status = 0;
 
 	/*
-		* Have a look at the available platforms and pick either
-		* the AMD one if available or a reasonable default.
-		*/
+	* Find all OpenCL platforms this system has to offer.
+	*/
 
-	cl_uint numPlatforms	= 0;
+	cl_uint numPlatforms = 0;
 	cl_platform_id platform = NULL;
-	OPENCL_V_THROW( ::clGetPlatformIDs( 0, NULL, &numPlatforms ),
-			"Getting number of platforms( ::clGetPlatformsIDs() )" );
+	OPENCL_V_THROW(::clGetPlatformIDs(0, NULL, &numPlatforms),
+		"Getting number of platforms( ::clGetPlatformsIDs() )");
 
-	if( numPlatforms > 0 )
+	if (numPlatforms > 0)
 	{
-		std::vector< cl_platform_id > platforms( numPlatforms );
-		OPENCL_V_THROW( ::clGetPlatformIDs( numPlatforms, &platforms[ 0 ], NULL ),
-			"Getting Platform Id's ( ::clGetPlatformsIDs() )" );
+		platforms.resize( numPlatforms );
+		devices.resize( numPlatforms );
+		OPENCL_V_THROW(::clGetPlatformIDs(numPlatforms, &platforms[0], NULL),
+			"Getting Platform Id's ( ::clGetPlatformsIDs() )");
 
-		//	TODO: How should we determine what platform to choose?  We are just defaulting to the last one reported, as we
-		//	print out the info
-		for( unsigned int i=0; i < numPlatforms; ++i )
+		if (NULL == platforms[0])
+		{
+			throw std::runtime_error("No appropriate OpenCL platform could be found");
+		}
+		
+		/*
+		* Now, for each platform get all available devices matching deviceType.
+		*/
+		for (unsigned int i = 0; i < numPlatforms; ++i)
 		{
-			if( printclInfo )
+			//	Get the device list for deviceType.
+			//
+			cl_uint numDevices = 0;
+			OPENCL_V_WARN(::clGetDeviceIDs(platforms[i], deviceType, 0, NULL, &numDevices),
+				"Getting OpenCL devices ( ::clGetDeviceIDs() )");
+			if (0 == numDevices)
 			{
-				std::cout << "OpenCL platform [ " << i << " ]:" << std::endl;
-				prettyPrintPlatformInfo( platforms[i] );
+				// OPENCL_V_WARN(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available");
+				continue;
 			}
 
-			platform = platforms[i];
+			devices[i].resize(numDevices);
+			OPENCL_V_THROW(::clGetDeviceIDs(platforms[i], deviceType, numDevices, &(devices[i])[0], NULL),
+				"Getting OpenCL deviceIDs ( ::clGetDeviceIDs() )");
 		}
 	}
 
-	if( NULL == platform )
+	return 0;
+}
+
+std::vector< cl_device_id > initializeCL( cl_device_type deviceType,
+										  cl_int deviceId,
+										  cl_context& context,
+										  bool printclInfo )
+{
+	cl_int status = 0;
+	cl_platform_id platform = NULL;
+	std::vector< cl_device_id > devices(1);
+	devices[0] = NULL;
+	
+	// Have a look at all the available platforms on this system
+	std::vector< cl_platform_id > platformInfos;
+	std::vector< std::vector< cl_device_id > > deviceInfos;
+	discoverCLPlatforms( deviceType, platformInfos, deviceInfos );
+	if (printclInfo)
 	{
-		throw std::runtime_error( "No appropriate OpenCL platform could be found" );
+		prettyPrintCLPlatforms(platformInfos, deviceInfos);
 	}
 
-	/*
-	 * If we could find our platform, use it. Otherwise use just available platform.
-	 */
-
-	//	Get the device list for this type.
-	//
-	cl_uint num_devices = 0;
-	OPENCL_V_THROW( ::clGetDeviceIDs( platform, deviceType, 0, NULL, &num_devices ),
-		"Getting OpenCL devices ( ::clGetDeviceIDs() )" );
-	if( 0 == num_devices )
+	if (deviceId >= 0)
 	{
-		OPENCL_V_THROW( CLFFT_DEVICE_NOT_AVAILABLE, "No devices available");
-	}
+		cl_int devNr = 0;
 
-	std::vector< cl_device_id > deviceIDs( num_devices );
-	OPENCL_V_THROW( ::clGetDeviceIDs( platform, deviceType, num_devices, &deviceIDs[0], NULL),
-		"Getting OpenCL deviceIDs ( ::clGetDeviceIDs() )" );
+		// A specific deviceId is selected, so try to find it
+		for (unsigned int i = 0; i < platformInfos.size(); ++i)
+		{
+			for (unsigned int n = 0; n < deviceInfos[i].size(); ++n)
+			{
+				if (deviceId == devNr)
+				{
+					platform = platformInfos[i];
+					devices[0] = deviceInfos[i][n];
+				}
 
-	if( (CL_DEVICE_TYPE_GPU == deviceType) && (~cl_uint(0) != deviceGpuList) )
+				devNr++;
+			}
+		}
+	}
+	else
 	{
-		//	The command line options specify to user certain gpu(s)
-		//
-		for( unsigned u = (unsigned) deviceIDs.size(); u-- > 0; )
+		// The default device (here: the last reported device) shall be selected
+		for (unsigned int i = 0; i < platformInfos.size(); ++i)
 		{
-			if( 0 != (deviceGpuList & (1<<u) ) )
-				continue;
-
-			//  Remove this GPU from the list
-			deviceIDs[u] = deviceIDs.back();
-			deviceIDs.pop_back();
+			for (unsigned int n = 0; n < deviceInfos[i].size(); ++n)
+			{
+				platform = platformInfos[i];
+				devices[0] = deviceInfos[i][n];
+			}
 		}
 	}
 
-	if( 0 == deviceIDs.size( ) )
+	// Do some error checking if we really selected a valid platform and a valid device
+	if (NULL == devices[0])
 	{
-		OPENCL_V_THROW( CLFFT_DEVICE_NOT_AVAILABLE, "No devices available");
+		OPENCL_V_THROW(CLFFT_DEVICE_NOT_AVAILABLE, "No devices available");
 	}
 
-	cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0 };
-
-	/////////////////////////////////////////////////////////////////
-	// Create an OpenCL context
-	/////////////////////////////////////////////////////////////////
-	context = clCreateContext( cps,
-							   (cl_uint) deviceIDs.size(),
-							   & deviceIDs[0],
-							   NULL,
-							   NULL,
-							   &status);
-	OPENCL_V_THROW( status, "Creating Context ( ::clCreateContextFromType() )" );
-
-	/* First, get the size of device list data */
-	size_t deviceListSize;
-	OPENCL_V_THROW( ::clGetContextInfo( context, CL_CONTEXT_DEVICES, 0, NULL, &deviceListSize ),
-		"Getting device array size ( ::clGetContextInfo() )" );
-
-	/////////////////////////////////////////////////////////////////
-	// Detect OpenCL devices
-	/////////////////////////////////////////////////////////////////
-	std::vector< cl_device_id > devices( deviceListSize/sizeof( cl_device_id ) );
-
-	/* Now, get the device list data */
-	OPENCL_V_THROW( ::clGetContextInfo( context, CL_CONTEXT_DEVICES, deviceListSize, &devices[ 0 ], NULL ),
-		"Getting device array ( ::clGetContextInfo() )" );
-
-	if( printclInfo )
+	if (NULL == platform)
 	{
-		cl_uint cContextDevices	= 0;
-
-		size_t deviceVersionSize	= 0;
-		OPENCL_V_THROW( ::clGetDeviceInfo( devices[0], CL_DEVICE_VERSION, 0, NULL, &deviceVersionSize ),
-			"Getting CL_DEVICE_VERSION Platform Info string size ( ::clGetDeviceInfo() )" );
-
-		std::vector< char > szDeviceVersion( deviceVersionSize );
-		OPENCL_V_THROW( ::clGetDeviceInfo( devices[0], CL_DEVICE_VERSION, deviceVersionSize, &szDeviceVersion[ 0 ], NULL ),
-			"Getting CL_DEVICE_VERSION Platform Info string ( ::clGetDeviceInfo() )" );
-
-		char openclstr[11]="OpenCL 1.0";
-
-		if (!strncmp((const char*)&szDeviceVersion[ 0 ], openclstr, 10))
-		{
-			cContextDevices	= 1;
-		}
-		else
-		{
-			OPENCL_V_THROW( ::clGetContextInfo( context, CL_CONTEXT_NUM_DEVICES, sizeof( cContextDevices ), &cContextDevices, NULL ),
-				"Getting number of context devices ( ::clGetContextInfo() )" );
-		}
-
-		for( cl_uint i = 0; i < cContextDevices; ++i )
-		{
-			std::cout << "OpenCL devices [ " << i << " ]:" << std::endl;
-			prettyPrintDeviceInfo( devices[i] );
-		}
-	}
+		throw std::runtime_error("No appropriate OpenCL platform could be found");
+	}	
+		
+	// Create an OpenCL context
+	cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties) platform, 0 };
+	context = clCreateContext(cps,
+		(cl_uint)devices.size(),
+		&devices[0],
+		NULL,
+		NULL,
+		&status);
+	OPENCL_V_THROW(status, "Creating Context ( ::clCreateContextFromType() )");
 
 	return devices;
 }
diff --git a/src/client/openCL.misc.h b/src/client/openCL.misc.h
index 4560d2b..de4e6d0 100644
--- a/src/client/openCL.misc.h
+++ b/src/client/openCL.misc.h
@@ -30,13 +30,22 @@
 #endif
 
 /*
+ * \brief OpenCL platform and device discovery
+ *        Creates a list of OpenCL platforms
+ *        and their associated devices 
+ */
+int discoverCLPlatforms( cl_device_type deviceType,
+					     std::vector< cl_platform_id >& platforms,
+						 std::vector< std::vector< cl_device_id > >& devices );
+
+/*
  * \brief OpenCL related initialization
  *        Create Context, Device list
  *        Load CL file, compile, link CL source
  *		  Build program and kernel objects
  */
 std::vector< cl_device_id > initializeCL( cl_device_type deviceType,
-										  cl_uint deviceGpuList,
+										  cl_int deviceId,
 										  cl_context& context,
 										  bool printclInfo );
 
@@ -102,6 +111,34 @@ inline cl_int OpenCL_V_Throw ( cl_int res, const std::string& msg, size_t lineno
 }
 #define OPENCL_V_THROW(_status,_message) OpenCL_V_Throw (_status, _message, __LINE__)
 
+inline cl_int OpenCL_V_Warn(cl_int res, const std::string& msg, size_t lineno)
+{
+	switch (res)
+	{
+		case	CL_SUCCESS:		/**< No error */
+			break;
+		case	CL_DEVICE_NOT_FOUND:
+			// This happens all the time when discovering the OpenCL capabilities of the system,
+			// so do nothing here.
+			break;
+		default:
+		{
+			std::stringstream tmp;
+			tmp << "OPENCL_V_WARN< ";
+			tmp << prettyPrintclFFTStatus(res);
+			tmp << " > (";
+			tmp << lineno;
+			tmp << "): ";
+			tmp << msg;
+			std::string errorm(tmp.str());
+			std::cout << errorm << std::endl;
+		}
+	}
+
+	return	res;
+}
+#define OPENCL_V_WARN(_status,_message) OpenCL_V_Warn (_status, _message, __LINE__);
+
 /*
  * \brief Release OpenCL resources (Context, Memory etc.)
  */
diff --git a/src/tests/cl_transform.h b/src/tests/cl_transform.h
index a0214ca..71e62e4 100644
--- a/src/tests/cl_transform.h
+++ b/src/tests/cl_transform.h
@@ -264,7 +264,7 @@ public:
 			cl_context tempContext = NULL;
 			device_id = initializeCL(
 				device_type,
-				device_gpu_list,
+				dev_id,
 				tempContext,
 				printInfo
 			);
diff --git a/src/tests/gtest_main.cpp b/src/tests/gtest_main.cpp
index b30c3ea..6fc648f 100644
--- a/src/tests/gtest_main.cpp
+++ b/src/tests/gtest_main.cpp
@@ -59,6 +59,8 @@ bool suppress_output = false;
 //	Globals that user can set on the command line, that need to be passed down to unit tests
 cl_device_type device_type = CL_DEVICE_TYPE_GPU;
 cl_uint device_gpu_list = ~0x0;
+cl_int dev_id = -1;
+
 bool comparison_type = root_mean_square;
 
 int main( int argc, char **argv )
@@ -104,6 +106,7 @@ int main( int argc, char **argv )
 		( "noInfoCL",      "Don't print information from the OpenCL runtime" )
 		( "cpu,c",         "Run tests on a CPU device" )
 		( "gpu,g",         "Run tests on a GPU device (default)" )
+		("device", po::value< cl_int >(&dev_id)->default_value(-1), "Run tests on a specific OpenCL device id as reported by clInfo")
 		( "pointwise,p",         "Do a pointwise comparison to determine test correctness (default: use root mean square)" )
 		( "tolerance,t",        po::value< float >( &tolerance )->default_value( 0.001f ),   "tolerance level to use when determining test pass/fail" )
 		( "numRandom,r",        po::value< size_t >( &number_of_random_tests )->default_value( 2000 ),   "number of random tests to run" )
@@ -168,7 +171,7 @@ int main( int argc, char **argv )
 		cl_context tempContext = NULL;
 		cl_command_queue tempQueue = NULL;
 		cl_event tempEvent = NULL;
-		std::vector< cl_device_id > device_id = ::initializeCL( device_type, device_gpu_list, tempContext, true );
+		std::vector< cl_device_id > device_id = ::initializeCL(device_type, dev_id, tempContext, true);
 		::cleanupCL( &tempContext, &tempQueue, 0, NULL, 0, NULL, &tempEvent );
 	}
 
diff --git a/src/tests/test_constants.cpp b/src/tests/test_constants.cpp
index cdc1ad6..cbaf790 100644
--- a/src/tests/test_constants.cpp
+++ b/src/tests/test_constants.cpp
@@ -88,7 +88,7 @@ size_t max_mem_available_on_cl_device(size_t device_index) {
 	cl_context tempContext = NULL;
 	device_id = initializeCL(
 		device_type,
-		device_gpu_list,
+		dev_id,
 		tempContext,
 		false
 		);
diff --git a/src/tests/test_constants.h b/src/tests/test_constants.h
index 6a45705..95699f5 100644
--- a/src/tests/test_constants.h
+++ b/src/tests/test_constants.h
@@ -63,6 +63,7 @@ extern float tolerance;
 
 extern cl_device_type device_type;
 extern cl_uint device_gpu_list;
+extern cl_int dev_id;
 
 extern size_t number_of_random_tests;
 extern time_t random_test_parameter_seed;
diff --git a/src/tests/unit_test.cpp b/src/tests/unit_test.cpp
index a446abc..671faab 100644
--- a/src/tests/unit_test.cpp
+++ b/src/tests/unit_test.cpp
@@ -29,12 +29,12 @@ protected:
 		lengths[ 0 ] = 32;
 		lengths[ 1 ] = 32;
 		lengths[ 2 ] = 32;
-		cl_uint	deviceGpuList = ~0; // a bitmap set
+		cl_int devId = -1;
 		commandQueueFlags = 0;
 
 		size_t memSizeBytes = lengths[ 0 ] * lengths[ 1 ] * lengths[ 2 ] * sizeof( std::complex< float > );
 
-		device_id = initializeCL( CL_DEVICE_TYPE_CPU, deviceGpuList, context, printInfo );
+		device_id = initializeCL( CL_DEVICE_TYPE_CPU, devId, context, printInfo );
 		createOpenCLCommandQueue( context,
 								  commandQueueFlags,
 								  queue,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/clfft.git



More information about the debian-science-commits mailing list