[rust-dev] rust and cuda

2014-09-06 Thread Madhu Srinivasan
Hello fellow Rustians,
I am wondering (before attempting anything) if anyone has tried creating cuda 
bindings for rust? Or has discovered any other route to use cuda kernels with 
rust as the host language ?
If not, I am willing to work in this direction, but would need some guidance 
from the community on using rust-bindgen and it's FFI usage etc. 

Thanks, 
Madhu
https://github.com/smadhueagle___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] rust and cuda

2014-09-06 Thread Madhu Srinivasan
Thanks ! Yes, I came across the blog and I've read the paper.  However, I am 
not looking at writing GPU Kernels in Rust that can be LLVM'ed into a PTX 
backend. 
I'm looking for something along the lines of rust-opencl 
https://github.com/luqmana/rust-opencl . 

I'll be looking into this more deeply in the coming weeks, so please let me 
know if you have any inputs/opinions.
Madhu

 Date: Sat, 6 Sep 2014 14:06:35 -0400
 Subject: Re: [rust-dev] rust and cuda
 From: co...@octayn.net
 To: smadhuea...@outlook.com
 CC: rust-dev@mozilla.org
 
 See http://www.cs.indiana.edu/~eholk/papers/hips2013.pdf and
 http://blog.theincredibleholk.org/blog/2012/12/05/compiling-rust-for-gpus/
 for prior work.
 
 On Sat, Sep 6, 2014 at 1:09 PM, Madhu Srinivasan
 smadhuea...@outlook.com wrote:
  Hello fellow Rustians,
 
  I am wondering (before attempting anything) if anyone has tried creating
  cuda bindings for rust? Or has discovered any other route to use cuda
  kernels with rust as the host language ?
 
  If not, I am willing to work in this direction, but would need some guidance
  from the community on using rust-bindgen and it's FFI usage etc.
 
 
  Thanks,
 
  Madhu
 
  https://github.com/smadhueagle
 
  ___
  Rust-dev mailing list
  Rust-dev@mozilla.org
  https://mail.mozilla.org/listinfo/rust-dev
 
 
 
 
 -- 
 http://octayn.net/
  ___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Suggestions for small Rust programs for use in a tutorial?

2013-06-09 Thread Madhu Srinivasan
Guys,
I'm not sure if this is what you are looking for, but I have been writing small 
(self-contained) examples in Rust - mostly to help me understand the language 
concepts. Still in very early stages, but I will be contributing more over the 
next few weeks.
https://github.com/smadhueagle/rustlings
Madhu

 Date: Thu, 6 Jun 2013 22:11:45 -0700
 From: catamorph...@gmail.com
 To: danielmi...@gmail.com
 CC: rust-dev@mozilla.org
 Subject: Re: [rust-dev] Suggestions for small Rust programs for use in a  
 tutorial?
 
 Jeaye,
 
 Tim,
 
 Not entirely sure if these are what you want, but bjz's glfw-rs repo
 has some basic examples of using glfw-rs that may serve as a basic
 example of Rust, too.
 
 See these:
 https://github.com/bjz/glfw-rs/blob/master/examples/cursor.rs
 https://github.com/bjz/glfw-rs/blob/master/examples/window.rs
 https://github.com/bjz/glfw-rs/blob/master/examples/gl-struct.rs
 
 Along with the rest here:
 https://github.com/bjz/glfw-rs/tree/master/examples
 
 Thanks for the suggestion! So far I'm not sure if these illustrate the
 main concepts I'm trying to get across, but they look great as
 potential additional extended examples.
 
 On Thu, Jun 6, 2013 at 9:52 PM, Daniel Micay danielmi...@gmail.com wrote:
  The Map trait is a bit ugly because it's sorely in need of default
  methods to reduce the burden on implementations.
 
  I think the Iterator trait in the `std::iterator` module is a great
  example, because it's a simple trait and it's easy to demonstrate
  implementations and adaptors for it. It's also a nice way of showing
  off the lifetime system because with owned containers you can't
  invalidate the iterators. I don't think there are many other languages
  able to represent something like statically freezable mutable
  containers.
 
 This is a great suggestion as well. I don't know why iterators didn't
 occur to me as a potential example; they almost stand alongside traits
 and borrowed pointers as major attractions on a tour of Rust.
 
 Cheers,
 Tim
 
 -- 
 Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt
 Not a riot, it's a rebellion. -- Boots Riley
 Attention Bros and Trolls: When I call out your spew, I'm not angry,
 I'm defiant. -- Reg Braithwaite
 ___
 Rust-dev mailing list
 Rust-dev@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev
  ___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


Re: [rust-dev] Mutability and borrowing

2013-06-03 Thread Madhu Srinivasan
Going by the suggested solution of using Atomic Reference Counters (std::arc) 
for sharing immutable data across different tasks, I would presume that the 
most generic solution would be to use the arc module. You can see an example of 
this in action here : 
https://github.com/smadhueagle/rustlings/blob/master/borrow.rs
Madhu

From: hata...@gmail.com
Date: Sat, 1 Jun 2013 22:30:35 -0700
To: abhijeet.ga...@gmail.com
CC: rust-dev@mozilla.org
Subject: Re: [rust-dev] Mutability and borrowing

True. I suppose I meant generic and memory efficient at the same time. I guess 
it shouldn't be too much of a hassle to implement the specialized case of this 
function if memory is absolutely critical.

Thanks


--
Ziad


On Sat, Jun 1, 2013 at 10:03 PM, Abhijeet Gaiha abhijeet.ga...@gmail.com 
wrote:



The 'copy' parameter is the most generic way for the client to 
handle this situation.


-- Abhijeet Gaihahttp://about.me/abhijeet.gaiha

 
On Sunday, 2 June 2013 at 10:32 AM, Ziad Hatahet wrote:

Thanks everyone. I actually thought about the two 
suggestions before posting. I thought there might be some common paradigm for 
this in the language though.



So I take it that implementing a += operator overload function would not have a 
generic way to handle the case where the same parameter is passed on both sides?



--
Ziad


On Sat, Jun 1, 2013 at 9:42 PM, Tim Chevalier catamorph...@gmail.com wrote:


On Sat, Jun 1, 2013 at 9:33 PM, Ziad Hatahet hata...@gmail.com wrote:

 I have the following function:



 fn add_equal(x: mut Complex, y: Complex) {

 x.real += y.real;

 x.imag += y.imag;

 }



 Calling the function with the same variable being passed to both arguments

 (i.e. add_equal(mut c, c)), results in the compile error:



 error: cannot borrow `c` as immutable because it is also borrowed as mutable



 I am guessing this is to avoid aliasing issues? What is the way around this?





You can copy y instead of passing a reference to it:

fn add_equal(x: mut Complex, y: Complex) { ...



Of course, that means that at the call site, you will have to write

something like add_equal(mut c, copy c).



Unless you want to write a function that just takes one argument and

doubles it, like Abhijeet suggested, I don't know of another way

around this.



Cheers,

Tim





--

Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt

Not a riot, it's a rebellion. -- Boots Riley

Attention Bros and Trolls: When I call out your spew, I'm not angry,

I'm defiant. -- Reg Braithwaite



___Rust-dev mailing 
listrust-...@mozilla.org

https://mail.mozilla.org/listinfo/rust-dev
 
 
 
 

 







___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev  
  ___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev