[asl] 96/177: Output supported OpenCL version
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Aug 27 09:22:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository asl.
commit a19e7c27b94c8669327eff4b40770fbb8f1cb750
Author: Avtech Scientific <AvtechScientific at users.noreply.github.com>
Date: Wed Jul 15 13:30:04 2015 +0300
Output supported OpenCL version
---
examples/flow/locomotive_in_tunnel.cc | 10 +++++-----
src/acl/aclHardware.cxx | 25 +++++++++++++++++--------
src/acl/aclHardware.h | 4 ++++
test/testACL/testHardware.cc | 2 +-
4 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/examples/flow/locomotive_in_tunnel.cc b/examples/flow/locomotive_in_tunnel.cc
index b8a02ee..24c776e 100644
--- a/examples/flow/locomotive_in_tunnel.cc
+++ b/examples/flow/locomotive_in_tunnel.cc
@@ -148,7 +148,7 @@ int main(int argc, char* argv[])
lbgk->init();
// Generate an instance for LBGK data initialization
asl::SPLBGKUtilities lbgkUtil(new asl::LBGKUtilities(lbgk));
- // Initialize the LBGK internal data so that the flow velocity of (0.1, 0, 0) in lattice units
+ // Initialize the LBGK internal data with the flow velocity of (0.1, 0, 0) [in lattice units]
lbgkUtil->initF(acl::generateVEConstant(.1, .0, .0));
auto vfTunnel(asl::generatePFConstant(makeAVec(0.1, 0., 0.)));
@@ -157,14 +157,14 @@ int main(int argc, char* argv[])
std::vector<asl::SPNumMethod> bcV;
- // Generate boundary conditions for the tunnel geometry. Constant velocity BC
+ // Generate boundary conditions for the tunnel geometry. Constant velocity BC
bc.push_back(generateBCVelocity(lbgk, vfTunnel, tunnelMap));
- // Generate boundary conditions for the tunnel geometry. Constant velocity BC
+ // Generate boundary conditions for the tunnel geometry. Constant velocity BC
// This BC is used for visualization.
bcV.push_back(generateBCVelocityVel(lbgk, vfTunnel, tunnelMap));
bcV.push_back(generateBCNoSlipRho(lbgk, tunnelMap));
- // Generate boundary conditions for the locomotive geometry. Non-slip BC
+ // Generate boundary conditions for the locomotive geometry. Non-slip BC
bc.push_back(generateBCNoSlip(lbgk, locomotive));
bcV.push_back(generateBCNoSlipVel(lbgk, locomotive));
bcV.push_back(generateBCNoSlipRho(lbgk, locomotive));
@@ -178,7 +178,7 @@ int main(int argc, char* argv[])
initAll(bc);
initAll(bcV);
- // Generate an object for force field of air on the locomotive
+ // Generate a numerical method for computation of the air force field that acts on the locomotive
auto computeForce(generateComputeSurfaceForce(lbgk, forceField, locomotive));
computeForce->init();
diff --git a/src/acl/aclHardware.cxx b/src/acl/aclHardware.cxx
index 86d3131..19edc47 100644
--- a/src/acl/aclHardware.cxx
+++ b/src/acl/aclHardware.cxx
@@ -27,6 +27,7 @@
#include "../utilities/aslParametersManager.h"
#include <fstream>
+
using namespace std;
using namespace asl;
@@ -58,14 +59,16 @@ namespace acl
cl_int status = 0;
status = cl::Platform::get(&platforms);
- errorMessage(status, "Platform::get()");
+ errorMessage(status, "acl::Platform::get()");
if (platforms.size() > 0)
{
for (unsigned int i = 0; i < platforms.size(); ++i)
{
+ // Probably not needed, since getDevices() seems to call clear() internally
+ devices.clear();
status = platforms[i].getDevices(CL_DEVICE_TYPE_ALL, &devices);
- errorMessage(status, "Platform::getDevices()");
+ errorMessage(status, "acl::Platform::getDevices()");
devicesInfo += "Platform: " + platforms[i].getInfo<CL_PLATFORM_VENDOR>()
+ "\nNumber of devices: " + numToStr(devices.size()) + "\n";
@@ -77,12 +80,12 @@ namespace acl
{
// Create an OpenCL context for the current device
context = cl::Context(vector<cl::Device>(1, devices[j]), cps, NULL, NULL, &status);
- errorMessage(status, "Context::Context()");
+ errorMessage(status, "acl::Context::Context()");
// Create an OpenCL command queue for current context and device
queues.push_back(CommandQueue(new cl::CommandQueue(context, devices[j], 0, &status)));
- errorMessage(status, "CommandQueue::CommandQueue()");
-
+ errorMessage(status, "acl::CommandQueue::CommandQueue()");
+
devicesInfo += "\t" + devices[j].getInfo<CL_DEVICE_NAME>() + "\n";
}
}
@@ -96,7 +99,7 @@ namespace acl
void Hardware::setDefaultQueue(const std::string & platform,
const std::string & device)
{
- defaultQueue = NULL;
+ defaultQueue = nullptr;
for (unsigned int i(0); i < queues.size(); ++i)
{
@@ -109,11 +112,11 @@ namespace acl
}
// Warn if requested combination of platform and device was not found
- if (defaultQueue == NULL)
+ if (defaultQueue.get() == nullptr)
{
// Choose first available device
defaultQueue = queues.front();
- warningMessage("Requested device not found! Using:\n" + getDefaultDeviceInfo());
+ warningMessage("Requested combination of platform(" + platform + ") and device(" + device + ") not found! Using:\n" + getDefaultDeviceInfo());
}
}
@@ -145,6 +148,12 @@ namespace acl
}
+ string getDeviceVersion(const CommandQueue & queue)
+ {
+ return getDevice(queue).getInfo<CL_DEVICE_VERSION>();
+ }
+
+
cl_device_type getDeviceType(const CommandQueue & queue)
{
return getDevice(queue).getInfo<CL_DEVICE_TYPE>();
diff --git a/src/acl/aclHardware.h b/src/acl/aclHardware.h
index 3f0361a..8493148 100644
--- a/src/acl/aclHardware.h
+++ b/src/acl/aclHardware.h
@@ -44,10 +44,14 @@ namespace acl
/// Returns vendor name.
/// \ingroup HardwareInformation
std::string getPlatformVendor(const CommandQueue & queue);
+
/// Returns device name.
/// \ingroup HardwareInformation
std::string getDeviceName(const CommandQueue & queue);
+ /** Returns the OpenCL version supported by the device */
+ std::string getDeviceVersion(const CommandQueue & queue);
+
/// Returns device type.
/// \ingroup HardwareInformation
cl_device_type getDeviceType(const CommandQueue & queue);
diff --git a/test/testACL/testHardware.cc b/test/testACL/testHardware.cc
index 06fe9c7..03e79ed 100644
--- a/test/testACL/testHardware.cc
+++ b/test/testACL/testHardware.cc
@@ -63,6 +63,7 @@ void printHardwareInfo(const CommandQueue & queue)
<< extensionAvailable(queue, CL_KHR_FP64) << endl;
cout << "\t\textension CL_KHR_INT64_EXTENDED_ATOMICS: "
<< extensionAvailable(queue, CL_KHR_INT64_EXTENDED_ATOMICS) << endl;
+ cout << "\t\tsupported OpenCL version: " << getDeviceVersion(queue) << endl;
}
@@ -111,6 +112,5 @@ int main()
}
}
-
return 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/asl.git
More information about the debian-science-commits
mailing list