@msz59 The original gauss routine posted has a “race” condition in the following line.
a(k, :) = a(k, :) - a(i, :) / a(i, i) * a(k, i)
This could be overcome by correct range or using ( daxpy )
factor = a(k, i) / a(i, i)
a(k, i+1:) = a(k, i+1:) - a(i, i+1:) * factor
This may resolve the problem, if not already corrected.