Groups 211 of 99+ julia-users › Parallelize Cpp using Julia? 6 posts by 3 authors David A. 7 26 14 Is it possible to parallelize the execution of a Cpp function using Julia? And would it be similarly efficient as doing it directly in Cpp? For instance sending the function: int foo arg1, arg2 with different values, each iteration executed on a different processor, and bringing back the results. Tim Holy 7 26 14 On Friday, July 25, 2014 09:49:47 PM David A. wrote: Is it possible to parallelize the execution of a Cpp function using Julia? Yes, if you can call the Cpp function in the first place. Currently your best bet is to write a Clanguage wrapper. There's the very primitive Cpp package, and Keno's got a real solution to the problem over at https: github.com Keno CXX-jl, but I don't know if it's really ready for users who are not Keno : . And would it be similarly efficient as doing it directly in Cpp? Depends on how you do it. You can, of course, just call pthreads from julia it's a Clanguage library, after all . Alternatively start a number of julia processes. You will want to read the parallel programming section of the manual. --Tim David A. 7 26 14 Sounds good. Would it be possible for the Cpp function to have access to Julia's arrays without copying them? ie passing them by reference Tim Holy 7 26 14 Yes, check out the section of the manual on calling Clanguage and Fortran code. --Tim Elliot Saba 7 26 14 You should be aware however, that there can be problems with accessing Julia code and variables from multiple threads. In particular, if you pass a Julia callback to Clanguage code, that Julia callback needs to run on the same thread as the one that created the callback in the first place, I believe. You can read about this at the Thread-Safety section of the page Tim was talking about. -E David A. 7 26 14 Thanks. I'll be checking those sources for more indepth info and how to implement it.