2
votes

I am trying to implement a parallel for loop in Julia. I am familiar with MATLAB coding but not with Julia. I have noticed that MATLAB requires cell type data structure to make the parallel code run faster. I have the following doubts:

  1. What is the alternative for "parfor" in Julia? Is there any package required to do so?

  2. Can we use "cell" in Julia? (To distribute the memory allocation, so that each memory location can be accessed independently.)

Any reference material would also be helpful.

1
I assume that Julia, as python, has some type of arrays that can contain anything in each entry, as opposed to MATLAB.Ander Biguri
This question is WAY too broad. Please, first find yourself a few tutorials about Julia, then familiarise yourself with the language, and then, come back with a more concrete question.Imanol Luengo
Basically, I need "cell" like structure to distribute the memory allocation so that it can be accessed independently in each parallel processing.Rajat
@ImanolLuengo Please suggest some references on Parallel Processing in Julia with a good number of examples. That would also be a great help.Rajat
You have everything you need in the official documentation, as for cell-like structures, Julia is not matlab, but has arbitrary-type containers (generic lists).Imanol Luengo

1 Answers

7
votes

1) Julia has pmap and @parallel built in. See https://docs.julialang.org/en/stable/manual/parallel-computing .

2) Instead of cell, just use an Array{Any} in Julia. So Array{Any}(n,m) is a matrix of size n x m that you can put anything in. Obviously, it's completely unoptimized so you should avoid that. Instead, you should try to strictly type your arrays when possible. In Julia, you can strictly type this to anything to make it efficient, so for example an array of strings is Array{String}(...). The shorthand it just to make it, like ["a","b","c"] and if you want to make it Any just put that in front: Any["a","b","c"] (and now you can add a number in there for example.