Comments (5)
I changed line 1128 of cl.hpp to:
param->assign(value.begin(), (value.back() != '\0') ? value.end() : value.end()-1);
This takes care of a trailing nuls in case any buggy OpenCL driver insists on delivering it. Doesn't look too clumsy, does it?
The alternative is not to advertise the macOS as a working platform anymore, because without taking care of the nuls in the one or the other form, ASL would be useless on the Mac.
from asl.
Those trailing '\0' chars are delivered by buggy OpenCL drivers. The problem is that a bad driver produces them and a good driver doesn't - with the same hardware and on the same OS. So you have to check whether they exist and if yes - strip them. We are not sure, however, that we should correct issues caused by bad drivers by making our code more clumsy.
from asl.
Those trailing '\0' chars are delivered by buggy OpenCL drivers.
It is quite hard for me to understand how this could happen, since any OpenCL driver is supposed to return a C string, i.e. a C array of chars terminated by a nul char, isn´t it?
Do OpenCL drivers on Linux really provide non-terminated arrays of chars? Isn´t it rather the C++ side which gives rise for a lot of confusion about subtle differences between character arrays and strings. My impression comes from searching Google about "C++ string trailing nul". Seems that the confusion started with the switch from C++11 to C++14. On macOS 10.12.6 the code is compiled with the latest clang++ (which is C++11) are you working with a C++14-compiler?
from asl.
Hi @cyclaero,
an elegant solution, indeed. And most importantly - cl.hpp is not actually ASL, but rather an C++wrapper to OpenCL - so it is the right place to take care of the issue. Do you want to make a Pull Request with this fix (and maybe your first solved issue as well)? We'll need to test them on a non Mac platform though...
Thank you!
from asl.
I had a closer look on the upstream C++-API headers on https://github.com/KhronosGroup/OpenCL-CLHPP. And it turned out, that the issue has been resolved in cl2.hpp on exactly the same place which I already suggested, however with a less C'ish and more C++'ish solution. So, I decided to go for back porting the upstream cl2 fix.
I cloned your repository to my GitHub account, I updated cl.hpp to the upstream version 1.2.9 and then back ported 2 fixes from cl2.hpp to the present cl.hpp for the specialized GetInfoHelper for string params, namely fix the trailing '\0' issue and the empty string result issue. Chances are that this would simply work on the vast majority of platforms since these fixes contain only code snippets which came from the Khronos Group.
see: cyclaero@a38f1d4
If this approach is OK for you, then I would submit a pull request, if not, then please inform.
from asl.
Related Issues (20)
- Segmentation fault HOT 5
- master build fails with VTK 7.1.0 RC1 HOT 1
- manpage for asl-hardware HOT 3
- examples and tests as standalone CMake projects
- Could not configure ASL in CMake HOT 1
- Cannot downconvert and widen scalar type 'double' to vector type '__float4' running examples HOT 14
- asl-locomotive error using vtk7.1.1 HOT 7
- OpenCL 1.0 support library HOT 1
- Small problem causes “call to 'select' is ambiguous” in all level set examples HOT 2
- The level set examples give strange and messed results
- multiple GPUS HOT 1
- how to run simulation on multi GPUs across different nodes in a cluster HOT 1
- Support VTK 8.1 HOT 1
- Program crash with Visual Studio HOT 2
- Mesh free and immersed boundary method
- Running locomotive example throws `std::logic_error`
- poro-elascitity example HOT 3
- Local CMakeParseArguments breaks with vtk 9.1 HOT 1
- Lack of instructions aimed to run a file with cc-extension when the source of acquisition of ASL is not the source repository HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asl.