src/tests/cl_transform.h
bool total_memory_footprint_is_too_large_for_device() {
		throw_if_device_list_is_empty();

		// In order to call clfftEnqueueTransform, we need to pass naked pointers
		cl_command_queue tempQueue = queue.get( );
		size_t buffer_size = 0;

		EXPECT_EQ( CLFFT_SUCCESS, clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL ));
		EXPECT_EQ( CLFFT_SUCCESS, clfftGetTmpBufSize(*plan_handle, &buffer_size ));

		cl_ulong total_memory_size = input.size_in_bytes() + buffer_size;

		// we are only going to include the result space if the transform is out of place
		if( placeness() == CLFFT_OUTOFPLACE )
		{
			total_memory_size += output.size_in_bytes();
		}

		cl_ulong global_memory_size = cl_device_max_global_memory(0);

		// we don't want to bog down the CPU with ginormous problem sizes
		// so we chop the global memory way down to keep things manageable
		if( g_device_type == CL_DEVICE_TYPE_CPU )
		{
			global_memory_size /= 8;
		}

		return total_memory_size > global_memory_size;
	}
/*****************************************************/
// returns true if the memory required for input + output (if applicable) + intermediate (if applicable) buffers
// is too large compared with the OpenCL device's memory size
returns true if the memory required for input + output (if applicable) + intermediate (if applicable) buffers
is too large compared with the OpenCL device's memory size
returns true if the memory required for input + output ( if applicable ) + intermediate ( if applicable ) buffers is too large compared with the OpenCL device ' s memory size
bool total_memory_footprint_is_too_large_for_device() {
		throw_if_device_list_is_empty();
		cl_command_queue tempQueue = queue.get( );
		size_t buffer_size = 0;
		EXPECT_EQ( CLFFT_SUCCESS, clfftBakePlan(*plan_handle, 1, &tempQueue, NULL, NULL ));
		EXPECT_EQ( CLFFT_SUCCESS, clfftGetTmpBufSize(*plan_handle, &buffer_size ));
		cl_ulong total_memory_size = input.size_in_bytes() + buffer_size;
		if( placeness() == CLFFT_OUTOFPLACE )
		{
			total_memory_size += output.size_in_bytes();
		}
		cl_ulong global_memory_size = cl_device_max_global_memory(0);
		if( g_device_type == CL_DEVICE_TYPE_CPU )
		{
			global_memory_size /= 8;
		}
		return total_memory_size > global_memory_size;
	}
bool total_memory_footprint_is_too_large_for_device ( ) { throw_if_device_list_is_empty ( ) ; cl_command_queue tempQueue = queue . get ( ) ; size_t buffer_size = 0 ; EXPECT_EQ ( CLFFT_SUCCESS , clfftBakePlan ( * plan_handle , 1 , & tempQueue , NULL , NULL ) ) ; EXPECT_EQ ( CLFFT_SUCCESS , clfftGetTmpBufSize ( * plan_handle , & buffer_size ) ) ; cl_ulong total_memory_size = input . size_in_bytes ( ) + buffer_size ; if ( placeness ( ) == CLFFT_OUTOFPLACE ) { total_memory_size += output . size_in_bytes ( ) ; } cl_ulong global_memory_size = cl_device_max_global_memory ( 0 ) ; if ( g_device_type == CL_DEVICE_TYPE_CPU ) { global_memory_size /= 8 ; } return total_memory_size > global_memory_size ; }
returns true if the memory required for input + output (if applicable) + intermediate (if applicable) buffers
is too large compared with the OpenCL device's memory size
returns true if the memory required for input + output ( if applicable ) + intermediate ( if applicable ) buffers is too large compared with the OpenCL device ' s memory size
// In order to call clfftEnqueueTransform, we need to pass naked pointers // we are only going to include the result space if the transform is out of place // we don't want to bog down the CPU with ginormous problem sizes // so we chop the global memory way down to keep things manageable