Hi there,
the following example compiles, but it crashes if I set the thread number > 1
Module ModClassOne Type :: ClassOne Real(kind=8), Allocatable, Dimension(:,:) :: tmp contains Procedure, Pass :: Mult => SubMultiply end type ClassOne Private :: SubMultiply contains Subroutine SubMultiply(this) Implicit None Class(ClassOne), Intent(InOut) :: this Integer :: i Do i=1,20 this%tmp=matmul(this%tmp,this%tmp) End Do End Subroutine SubMultiply end Module ModClassOne Program Test use ModClassOne Implicit None Type(ClassOne) :: T1, T2 Integer :: dim=1000 Allocate(T1%tmp(dim,dim),T2%tmp(dim,dim)) !$OMP PARALLEL NUM_THREADS(2) !$OMP SECTIONS !$OMP SECTION call T1%Mult() !$OMP SECTION call T2%Mult() !$OMP END SECTIONS !$OMP END PARALLEL End Program Test
My questions is ....................... why???
In the end I am aiming to run all objects of a class on its own single core since all objects have only variables bound to the type, thus, the calling sequence of any routine will not contain more than (this).
Thanks a lot.
Karl