17.11.2014 Views

practicals

practicals

practicals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Class Exercise 2 (recommended solution)<br />

subroutine work(k,a,unique)<br />

integer*8 k,a(k),unique<br />

integer*4,allocatable :: b(:)<br />

allocate(b(k))<br />

b(:)=0<br />

!$OMP PARALLEL DO PRIVATE(I)<br />

do i=1,k<br />

b(a(i))=1<br />

enddo<br />

!$OMP END PARALLEL DO<br />

unique=sum(b)<br />

deallocate(b)<br />

return<br />

end<br />

Slide 5<br />

ECMWF

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!