Shared mem parallel implementation