Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Added simple Intel support for tests #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ elseif( CMAKE_COMPILER_IS_GNUCC )
message( STATUS "Detected GNU compiler collection" )

if( clSPARSE_BUILD64 )
set( CMAKE_CXX_FLAGS "-m64 ${CMAKE_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS "-g -m64 ${CMAKE_CXX_FLAGS}" )
set( CMAKE_C_FLAGS "-m64 ${CMAKE_C_FLAGS}" )
else( )
set( CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS "-g -m32 ${CMAKE_CXX_FLAGS}" )
set( CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}" )
endif( )
else( )
Expand Down
12 changes: 10 additions & 2 deletions src/tests/resources/opencl_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cl::Device getDevice( cl_platform_type pID, cl_uint dID )

std::map<std::string, int> pNames;

//search for AMD or NVIDIA
//search for AMD, NVIDIA or INTEL
cl_int pIndex = -1;
for( const auto& p : platforms )
{
Expand All @@ -96,13 +96,21 @@ cl::Device getDevice( cl_platform_type pID, cl_uint dID )

//get index of desired platform;
std::string desired_platform_name;
int device_type;
if( pID == AMD )
{
desired_platform_name = amd_platform_str;
device_type = CL_DEVICE_TYPE_GPU;
}
else if( pID == NVIDIA )
{
desired_platform_name = nvidia_platform_str;
device_type = CL_DEVICE_TYPE_GPU;
}
else if( pID == INTEL )
{
desired_platform_name = intel_platform_str;
device_type = CL_DEVICE_TYPE_CPU;
}
else
{
Expand All @@ -122,7 +130,7 @@ cl::Device getDevice( cl_platform_type pID, cl_uint dID )
}

std::vector<cl::Device> devices;
platforms[ pIndex ].getDevices( CL_DEVICE_TYPE_GPU, &devices );
platforms[ pIndex ].getDevices( device_type, &devices );

assert( dID < devices.size( ) );

Expand Down
4 changes: 3 additions & 1 deletion src/tests/resources/opencl_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@

typedef enum _platform {
AMD = 0,
NVIDIA
NVIDIA = 1,
INTEL = 2,
} cl_platform_type;

const static std::string amd_platform_str = "AMD";
const static std::string nvidia_platform_str = "NVIDIA";
const static std::string intel_platform_str = "Intel(R)";

cl_int getPlatforms( cl_platform_id **platforms, cl_uint* num_platforms );

Expand Down
6 changes: 5 additions & 1 deletion src/tests/test-blas1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ int main (int argc, char* argv[])
desc.add_options()
("help,h", "Produce this message.")
("platform,l", po::value(&platform)->default_value("AMD"),
"OpenCL platform: AMD or NVIDIA.")
"OpenCL platform: AMD, NVIDIA or INTEL.")
("device,d", po::value(&dID)->default_value(0),
"Device id within platform.")
("size,s",po::value(&size)->default_value(1024),
Expand Down Expand Up @@ -669,6 +669,10 @@ int main (int argc, char* argv[])
{
pID = NVIDIA;
}
else if ("INTEL" == platform)
{
pID = INTEL;
}
else
{

Expand Down
6 changes: 5 additions & 1 deletion src/tests/test-blas2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ int main (int argc, char* argv[])
("help,h", "Produce this message.")
("path,p", po::value(&path)->required(), "Path to matrix in mtx format.")
("platform,l", po::value(&platform)->default_value("AMD"),
"OpenCL platform: AMD or NVIDIA.")
"OpenCL platform: AMD, NVIDIA or INTEL.")
("device,d", po::value(&dID)->default_value(0),
"Device id within platform.")
("alpha,a", po::value(&alpha)->default_value(1.0),
Expand Down Expand Up @@ -439,6 +439,10 @@ int main (int argc, char* argv[])
{
pID = NVIDIA;
}
else if ("INTEL" == platform)
{
pID = INTEL;
}
else
{

Expand Down
6 changes: 5 additions & 1 deletion src/tests/test-blas3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ int main (int argc, char* argv[])
("path,p", po::value(&path)->required(), "Path to matrix in mtx format.")
("function,f", po::value<std::string>(&function)->default_value("SpMdM"), "Sparse functions to test. Options: SpMdM, SpMSpM, All")
("platform,l", po::value(&platform)->default_value("AMD"),
"OpenCL platform: AMD or NVIDIA.")
"OpenCL platform: AMD, NVIDIA or INTEL.")
("device,d", po::value(&dID)->default_value(0),
"Device id within platform.")
("alpha,a", po::value(&alpha)->default_value(1.0),
Expand Down Expand Up @@ -707,6 +707,10 @@ int main (int argc, char* argv[])
{
pID = NVIDIA;
}
else if ("INTEL" == platform)
{
pID = INTEL;
}
else
{
std::cout << "The platform option is missing or is ill defined!\n";
Expand Down