Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

sort the array

yingwu
Beginner
799 Views
Hi,

I need to sort a 1-dimensional real-type array. I find I can use sortqq and qsort. Is there any difference?

By the way, could I ask what is integer(2)???? What the '(2)' is for?

Thanks very much.
0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
799 Views

How large is the array?
Are multiple cores available?
Is the output array the input array? (or seperate arrays)

integer(2) means 2-byte integer (16-bits). In C this would be a short (short int)

Jim

0 Kudos
yingwu
Beginner
799 Views

How large is the array?
Are multiple cores available?
Is the output array the input array? (or seperate arrays)

integer(2) means 2-byte integer (16-bits). In C this would be a short (short int)

Jim


the array has 10000 elements. Yes, 4 CPUs. A seperate array is expected.

0 Kudos
jimdempseyatthecove
Honored Contributor III
799 Views

For 10,000 reals, SORTQQ may be faster than QSORT (experiment).
However, QSORT has the advantage of being able to check for NaN's and/or denormalized nubmers.

The disadvantage of both is they sort in place (as opposed to takingin and out arrays).

If this sort occures very often, then it might be worth the effort to write a specialized sort (SSE using multiple threads). 10,000 is probably not large enough to involve multiple threads, but involving SSE may help.

Jim
0 Kudos
Reply