I have a (semi) theoretical question.
Is it possible to compile C code with a parallel specific compiler such as OpenMP, CUDA, etc., to write a C extension to the Ruby language that operates better (theoretically) for distributed machines?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If what you mean is, can you compile parallel C code as Ruby extensions, I think you mostly should be able to do so. For example, a numeric extension to Ruby that does matrix multiplications can call into Intel MKL’s
DGEMMroutine and MKL is parallelised internally with OpenMP.You should only be careful not to mix in the same program extensions that use different OpenMP runtimes. Take for example GCC, Intel C/C++ compiler, and Oracle’s Solaris Studio. Each of them uses has its own implementation of the OpenMP runtime. These implementations are at large incompatible with each other and mixing them in the same executable (either by static linking or by dynamically loading modules at runtime) is a call to disaster.
Another thing to note is whether the Ruby runtime is thread-safe and whether it could be called from a multithreaded code. This remark is not relevant if one does not call the Ruby runtime from inside OpenMP
parallelregions.As there is a single CUDA vendor, one should only be concerned with version mismatches when it comes to CUDA-enabled extensions.