OpenCL: pipes and custom types - struct

I am trying to use the new pipes features of OpenCL 2.0, but I can't get them to work with a custom data type of mine, that has been defined with a struct.
Does anyone know a workaround for using pipes and custom data types?
thanks

Related

How to implement Spark UDF class for a not yet supported programming language?

I want to implement a wrapper for Spark UDFs in an officially unsupported programming language (namely, Julia). Previously, I already implemented RDD API, so running workers and communication between processes isn't a problem. However, it's unclear for me which interfaces should be implemented by a wrapper class to make it work with Catalyst.
I started with PythonUDF which implements Expression interface and holds PythonFunction to be called on input data. However, PythonUDF doesn't implement the eval() method (the class extends Unevaluable trait) and thus is not responsible for executing by itself. Instead, there are several additional classes like ArrowEvalPythonExec which do the actual job. But what is in between?
To make this question more concrete, I'd like to know any of these:
How does PythonUDF turn into actual code?
What is the easiest way to implement similar behavior for a new programming language?

What are the differences between torch.jit.trace and torch.jit.script in torchscript?

Torchscript provides torch.jit.trace and torch.jit.script to convert pytorch code from eager mode to script model. From the documentation, I can understand torch.jit.trace cannot handle control flows and other data structures present in the python. Hence torch.jit.script was developed to overcome the problems in torch.jit.trace.
But it looks like torch.jit.script works for all the cases, then why do we need torch.jit.trace?
Please help me understand the difference between these two methods
If torch.jit.script works for your code, then that's all you should need. Code that uses dynamic behavior such as polymorphism isn't supported by the compiler torch.jit.script uses, so for cases like that, you would need to use torch.jit.trace.

How can I use WebGL extensions from web_sys in Rust

I'd like to use WebGL Extensions from within Rust code that is compiled to WebAssembly. The web_sys::WebGlRenderingContext has a method get_extension which returns a JsValue.
I expect there is a way to either use the dyn_into method to get an ANGLE_instanced_arrays interface, which according to this webidl may be included in web_sys somewhere, but I can't seem to get at it. If it's not possible to get to the ANGLE_instanced_arrays interface, is it possible to call known methods and properties using the JsValue directly?
I noticed that you also posted your question on the wasm-bindgen issues log where they provided some useful information. For other people who come across this I thought I would share the link.
https://github.com/rustwasm/wasm-bindgen/issues/1257
As per this issue: wasm-bindgen issue 893 - Figure out how to support interfaces with NoInterfaceObject attribute The WebGL extensions should be available in the next release.

Extensible registry of types

I have a program that can read multiple audio formats. A shared module could provide a trait, AudioFileReader, that has common methods for reading audio data as well as a registry for associating readers to file extensions.
Rather than have all the possible audio format readers built into the module, it would be useful for this module to be extensible, so that clients of the module can provide AudioFileReaders for new formats (either when linked into an executable or via a plug-in system).
What would be a conventional Rust way to build a system like this? Is there a way to avoid needing a global static registry while without losing extensibility?
You can build such a registry by using a lazy_static global, which contains a map of extension name to Box<AudioFileReader>.
You would have to list them all in main (or have main call init functions). There's no way to automatically do this, Rust has no life before main.

Can I use the Rust lexer or parser to retrieve a list of functions within a Rust file?

The lexer/parser file located here is quite large and I'm not sure if it is suitable for just retrieving a list of Rust functions. Perhaps writing my own/using another library would be a better route to take?
The end objective would be to create a kind of execution manager. To contextualise, it would be able to read a list of function calls wrapped in a function. The function calls that are within the function will then be able to be re/ordered from some web interface. Thought it might be nice to manage larger applications this way.
No. I mean, not really. Whether you write your own parser or re-use syntex, you're going to hit a fundamental limitation: macros.
So let's say you go all-out and expand macro_rules!-based macros, including the ones defined in external crates (which means you'll also need to extract rustc's crate metadata loading... which isn't stable). What about procedural macros and custom derive attributes? Those are defined in code and depend on compiler-internal interfaces to function.
The only way this is likely to ever work correctly is if you build on top of the compiler, or duplicate a huge amount of work (which also involves unstable binary interfaces).
You could use syntex to parse the Rust code in a build script.

Resources