Hi,

I need to compute the permutations to sort scalar values of a Vec object in 
decreasing order. I've been developing on a single process for now, using 
VecGetArrayRead() to extract the values and PetscSortRealWithPermutation() to 
get the permutations.

I would like to run the code on multiple processes. From these links, I can see 
it's an issue :
https://lists.mcs.anl.gov/pipermail/petsc-users/2013-November/019628.html
https://lists.mcs.anl.gov/pipermail/petsc-users/2009-June/004621.html

One work around I've been considering : get the max scalar value using VecMax() 
; compute a scaling factor that makes this max value equals the largest integer 
value tolerated by PetscInt ; scale all values of Vec and convert them to 
integers ; use PetscParallelSortInt() ; inverse the scaling on (now sorted) 
integers values and convert them back to scalars.

This is only a patch really, the main issues being : (1) I would get a sorted 
Vec, not the permutations and (2) there would be a lost of information when 
converting scalars to int values.

Isn't there a way to parallel sort real values using Petsc?

Thank you very much!

Antoine Côté


Reply via email to