[asl] 36/177: Simplifying Hardware interface
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Aug 27 09:22:36 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 205b00840f1ed3ca80a303fffa64cff4d36f4edd
Author: AvtechScientific <AvtechScientific at users.noreply.github.com>
Date: Thu Jun 18 21:24:08 2015 +0300
Simplifying Hardware interface
---
src/acl/aclHardware.cxx | 29 +++++++++--------------------
src/acl/aclHardware.h | 3 ---
src/utilities/aslParametersManager.cxx | 5 +++--
3 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/src/acl/aclHardware.cxx b/src/acl/aclHardware.cxx
index 340f15e..46b3b5a 100644
--- a/src/acl/aclHardware.cxx
+++ b/src/acl/aclHardware.cxx
@@ -48,8 +48,7 @@ namespace acl
Hardware::Hardware():
- devicesInfo("\n\n# List of all available devices\n"),
- defaultDeviceInfo("")
+ devicesInfo("")
{
// Scan all available platforms and their devices
vector<cl::Platform> platforms;
@@ -67,8 +66,8 @@ namespace acl
{
status = platforms[i].getDevices(CL_DEVICE_TYPE_ALL, &devices);
errorMessage(status, "Platform::getDevices()");
- devicesInfo += "# Platform: " + platforms[i].getInfo<CL_PLATFORM_VENDOR>()
- + "\n# Number of devices: " + numToStr(devices.size()) + "\n";
+ devicesInfo += "Platform: " + platforms[i].getInfo<CL_PLATFORM_VENDOR>()
+ + "\nNumber of devices: " + numToStr(devices.size()) + "\n";
cps[0] = CL_CONTEXT_PLATFORM;
cps[1] = (cl_context_properties)(platforms[i])();
@@ -84,14 +83,13 @@ namespace acl
queues.push_back(CommandQueue(new cl::CommandQueue(context, devices[j], 0, &status)));
errorMessage(status, "CommandQueue::CommandQueue()");
- devicesInfo += "# \t" + devices[j].getInfo<CL_DEVICE_NAME>() + "\n";
+ devicesInfo += "\t" + devices[j].getInfo<CL_DEVICE_NAME>() + "\n";
}
}
}
// Set first found queue as default queue
defaultQueue = queues.front();
- setDefaultDeviceInfo();
}
@@ -107,7 +105,6 @@ namespace acl
{
// Choose requested device on requested platform
defaultQueue = queues.back();
- setDefaultDeviceInfo();
}
}
@@ -116,31 +113,23 @@ namespace acl
{
// Choose first available device
defaultQueue = queues.front();
- setDefaultDeviceInfo();
- warningMessage("Requested device not found! Using:\n" + defaultDeviceInfo);
+ warningMessage("Requested device not found! Using:\n" + getDefaultDeviceInfo());
}
}
- void Hardware::setDefaultDeviceInfo()
- {
- defaultDeviceInfo = "# Default computation device";
- defaultDeviceInfo += "\nplatform = " + getPlatformVendor(defaultQueue)
- + "\ndevice = " + getDeviceName(defaultQueue);
- }
-
-
std::string Hardware::getDefaultDeviceInfo()
{
+ string defaultDeviceInfo("\nplatform = " + getPlatformVendor(defaultQueue)
+ + "\ndevice = " + getDeviceName(defaultQueue));
return defaultDeviceInfo;
}
-
void Hardware::loadConfiguration(const string & fileName)
{
/* ParametersManager parametersManager;
- Parameter<string> platform("", "platform", "Default platform", "");
- Parameter<string> device("", "device", "Default device", "");
+ Parameter<string> platform("", "platform", "Default computation platform", "");
+ Parameter<string> device("", "device", "Default computation device", "");
parametersManager.load(fileName);
defaultPlatform = platform.v();
diff --git a/src/acl/aclHardware.h b/src/acl/aclHardware.h
index 5ab3100..97d3089 100644
--- a/src/acl/aclHardware.h
+++ b/src/acl/aclHardware.h
@@ -146,10 +146,7 @@ namespace acl
std::string getDevicesInfo();
std::string getDefaultDeviceInfo();
private:
- // Sets defaultDeviceInfo based on current defaultQueue
- void setDefaultDeviceInfo();
std::string devicesInfo;
- std::string defaultDeviceInfo;
};
diff --git a/src/utilities/aslParametersManager.cxx b/src/utilities/aslParametersManager.cxx
index 771db98..321cdc7 100644
--- a/src/utilities/aslParametersManager.cxx
+++ b/src/utilities/aslParametersManager.cxx
@@ -349,8 +349,9 @@ namespace asl
if (vm.count("devices"))
{
cout << programName + " " + programVersion + "\n\n"
- << acl::hardware.getDevicesInfo()
- << endl;
+ << acl::hardware.getDefaultDeviceInfo() << "\n\n"
+ << acl::hardware.getDevicesInfo()
+ << endl;
exit(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