How to implement shared memory in fortran coarray? It’s to me that every image have a copy of local variable. Although fortran is a global address space language (PGAS) which means that one image is easy to access the data of other images. As to me, this is valid only for fortran coarrays. How about the local variable?
In the source code of neural-fortran https://github.com/modern-fortran/neural-fortran and the subrotuine of
train_batch , there is a code snippet
real(rk), intent(in) :: x(:,:), y(:,:), eta indices = tile_indices(im) is = indices(1) ie = indices(2) call db_init(db_batch, self % dims) call dw_init(dw_batch, self % dims) do concurrent(i = is:ie) call self % fwdprop(x(:,i)) call self % backprop(y(:,i), dw, db) do concurrent(n = 1:nm) dw_batch(n) % array = dw_batch(n) % array + dw(n) % array db_batch(n) % array = db_batch(n) % array + db(n) % array end do end do
It’s clearly that the
ie are the index of data for present image. But we simply use the
y(x:i) to access the data which are not coarray by the definition. Does it means that every image has a copy of all the x and y. If so, when the number of image is incrased, the memory will blow up ?
In the paper of “A parallel Fortran framework for neural networksand deep learning”, the author says that
Elapsed times on up to 12 parallel images on a shared-memory system are shown in Figure 4.
What’s the meaning of shared-memory system? I do not get the meaning of shared-memory as every image has a copy of the dataset.
To be clear, does fortran coarray supports shared memory ? If yes, how to implement the shared memory code?