diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e0cfc77977f1211ee849b10e1359d84e393a5cf..ab19bce412b58927c3a49a694e4b20ff819c0bc1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ project(
 find_package(xtl 0.7.5 REQUIRED)
 message(STATUS "Found xtl: ${xtl_INCLUDE_DIRS}/xtl")
 
-find_package(xtensor 0.24.6 REQUIRED)
+find_package(xtensor 0.24.7 REQUIRED)
 message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
 
 # ------------------------------------------------------------------------------
diff --git a/changelog.rst b/changelog.rst
index bbe328ec72bcc1c908864407c4b031ce7b55425d..8133903a1f94220cef8c67e835e9307a1ef01181 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -9,7 +9,9 @@ Yet to be versioned and released. Only available from *dev* branch until then.
 
 * add support for minute and hourly time steps in bootstrapping functionality
   (`CPP#9 <https://gitlab.irstea.fr/HYCAR-Hydro/evalhyd/evalhyd-cpp/-/issues/9>`_)
-
+* add `"KGENP"` and `"KGENP_D"` as deterministic evaluation metrics since
+  stable sorting is now available in ``xtensor``
+  (`CPP#5 <https://gitlab.irstea.fr/HYCAR-Hydro/evalhyd/evalhyd-cpp/-/issues/5>`_)
 
 v0.1.1
 ------
diff --git a/include/evalhyd/detail/determinist/efficiencies.hpp b/include/evalhyd/detail/determinist/efficiencies.hpp
index b5d230249aae761f65d8b102a877631a66cad75a..44ec294957da82ddb3ece86582e277c363a26fba 100644
--- a/include/evalhyd/detail/determinist/efficiencies.hpp
+++ b/include/evalhyd/detail/determinist/efficiencies.hpp
@@ -150,29 +150,22 @@ namespace evalhyd
                             auto obs_filtered =
                                     xt::filter(obs, !xt::isnan(obs));
 
-                            // -------------------------------------------------
-                            // TODO: use `xt::argsort` with `xt::sorting_method::stable`
-                            //       when this becomes possible with `xtensor` to
-                            //       consistently sort ties across compilers
-                            //       https://github.com/xtensor-stack/xtensor/issues/2677
-                            //       note that the second sorting (to get the
-                            //       rank) does not need the stable method
-                            //       because there will be no ties after the
-                            //       first sorting
-                            auto prd_sort = xt::argsort(xt::eval(prd_filtered));
-                            auto obs_sort = xt::argsort(xt::eval(obs_filtered));
-                            // -------------------------------------------------
+                            auto prd_sort = xt::argsort(
+                                    xt::eval(prd_filtered), {0},
+                                    xt::sorting_method::stable
+                            );
+                            auto obs_sort = xt::argsort(
+                                    xt::eval(obs_filtered), {0},
+                                    xt::sorting_method::stable
+                            );
 
                             auto prd_rank = xt::eval(xt::argsort(prd_sort));
                             auto obs_rank = xt::eval(xt::argsort(obs_sort));
 
-                            auto mean_prd_rank =
-                                    xt::eval(xt::nanmean(prd_rank));
-                            auto mean_obs_rank =
-                                    xt::eval(xt::nanmean(obs_rank));
+                            auto mean_rank = (prd_rank.size() - 1) / 2.;
 
-                            auto prd_rank_err = xt::eval(prd_rank - mean_prd_rank);
-                            auto obs_rank_err = xt::eval(obs_rank - mean_obs_rank);
+                            auto prd_rank_err = xt::eval(prd_rank - mean_rank);
+                            auto obs_rank_err = xt::eval(obs_rank - mean_rank);
 
                             auto r_num = xt::nansum(prd_rank_err * obs_rank_err);
 
diff --git a/include/evalhyd/evald.hpp b/include/evalhyd/evald.hpp
index 580b4f0c3ad99dacc2d09a37d06c79dca21b89f2..c18b3045753a8b41e499b79bd6a30266e732c95e 100644
--- a/include/evalhyd/evald.hpp
+++ b/include/evalhyd/evald.hpp
@@ -246,13 +246,7 @@ namespace evalhyd
                 metrics,
                 {"MAE", "MARE", "MSE", "RMSE",
                  "NSE", "KGE", "KGE_D", "KGEPRIME", "KGEPRIME_D",
-                 // ------------------------------------------------------------
-                 // TODO: bring back when `xt::argsort` supports stable sorting
-                 //       so that the r_spearman component of KGENP and KGENP_D
-                 //       yields consistent results across compilers
-                 //       https://github.com/xtensor-stack/xtensor/issues/2677
-                 // "KGENP", "KGENP_D",
-                 // ------------------------------------------------------------
+                 "KGENP", "KGENP_D",
                  "CONT_TBL"}
         );
 
diff --git a/tests/expected/evald/KGENP.csv b/tests/expected/evald/KGENP.csv
new file mode 100644
index 0000000000000000000000000000000000000000..da8215deaad1ca77c250729974cdfb97ecdb11b9
--- /dev/null
+++ b/tests/expected/evald/KGENP.csv
@@ -0,0 +1,51 @@
+0.9036196405840838,
+0.9027149491299032,
+0.9019964203149340,
+0.9015473483249743,
+0.9010227409078427,
+0.9002935342284578,
+0.8996776226282514,
+0.8994216492339094,
+0.8990977208488355,
+0.8987350709875637,
+0.8982532429397716,
+0.8976861184526075,
+0.8972152067006425,
+0.8968237918617401,
+0.8964733361016016,
+0.8958912350965430,
+0.8955633883538662,
+0.8952428069377452,
+0.8949345862320413,
+0.8946525212872837,
+0.8942745923214641,
+0.8940089723492346,
+0.8935943964262417,
+0.8932560897547058,
+0.8928803002007193,
+0.8925226440231935,
+0.8921614576327788,
+0.8918237045929703,
+0.8914308286219610,
+0.8910650664139746,
+0.8908211410044876,
+0.8903097144311038,
+0.8897023851839844,
+0.8890303874814716,
+0.8886702633964977,
+0.8882116628141731,
+0.8875818375621527,
+0.8868808169065676,
+0.8858920353229134,
+0.8852878632825192,
+0.8849502078228993,
+0.8844861762981348,
+0.8836425483698741,
+0.8826408130506563,
+0.8818114019975033,
+0.8806522435640054,
+0.8792440943389407,
+0.8777199708282357,
+0.8749280250179110,
+0.8718181395679226,
+0.8615027580099652
diff --git a/tests/expected/evald/KGENP_D.csv b/tests/expected/evald/KGENP_D.csv
new file mode 100644
index 0000000000000000000000000000000000000000..2ca908c252b9f91ec8e5a614cf30de2251ccaf79
--- /dev/null
+++ b/tests/expected/evald/KGENP_D.csv
@@ -0,0 +1,51 @@
+0.9520277979462711,0.9497765351583353,1.0668239858924582,
+0.9523126391293594,0.9499605171079959,1.0684568980300118,
+0.9524758044569267,0.9500741432348777,1.0696675053044051,
+0.9528188904757725,0.9501160335929643,1.0705581846521615,
+0.9528559916382756,0.9502337695934666,1.0713951161082431,
+0.9528587841988941,0.9500393279828702,1.0722704389155211,
+0.9530594496261958,0.9498915009792210,1.0731457617227991,
+0.9530614443123518,0.9499496825957654,1.0735373535050023,
+0.9531859127284913,0.9499396120529464,1.0740517976110342,
+0.9532672959236593,0.9498873351942252,1.0745611228702399,
+0.9532529341833356,0.9498539983260041,1.0751830627596215,
+0.9532968172787694,0.9497273044373882,1.0758920230450484,
+0.9533793972856310,0.9496601087761085,1.0765318788983218,
+0.9534292644395331,0.9495354662866569,1.0770053722297441,
+0.9534472166149378,0.9494905674176269,1.0774558307504485,
+0.9534240782555273,0.9493484046086818,1.0781263996846790,
+0.9534344506235389,0.9492972712034291,1.0785359074307741,
+0.9534404346820071,0.9492265991089008,1.0789198209427380,
+0.9534687592254235,0.9491619974453277,1.0793037344547021,
+0.9536770044601183,0.9491650765239747,1.0798002625968421,
+0.9536626427197945,0.9491350202913762,1.0802711965048515,
+0.9537129088109277,0.9491315924723295,1.0806474317465762,
+0.9537129088109277,0.9490598383917315,1.0811465193121295,
+0.9537687600232979,0.9490004286134792,1.0815841807157685,
+0.9537611802159048,0.9489625645445023,1.0820474363535382,
+0.9539506754007324,0.9489310578873620,1.0826002718107666,
+0.9539789999441488,0.9489579598218398,1.0831019187997328,
+0.9540240798512762,0.9488668916806536,1.0835088671224147,
+0.9540384415916000,0.9487590811954164,1.0839593256431190,
+0.9540224841023514,0.9487666979551599,1.0844277001277152,
+0.9541297982175484,0.9487387792434008,1.0847834599821353,
+0.9541433620834098,0.9486800858387021,1.0854130781417561,
+0.9541752770619071,0.9485263682674370,1.0861169195803568,
+0.9541728834385198,0.9483531735489698,1.0868719494872194,
+0.9542379102072081,0.9482801928686959,1.0873224080079240,
+0.9546978848348001,0.9481534173885801,1.0880697596445472,
+0.9547242146920604,0.9480523537998038,1.0888222301279968,
+0.9547194274452857,0.9478976549520498,1.0896156513860558,
+0.9546683634796901,0.9477531014579976,1.0907520353814693,
+0.9548367149912633,0.9476282681201116,1.0915224218288104,
+0.9550158378080793,0.9476574803442240,1.0920496630519076,
+0.9554363176497810,0.9475728061854791,1.0927842175714655,
+0.9555336583341977,0.9475197380039366,1.0938489377113123,
+0.9555081263513999,0.9473232139636073,1.0949674057428342,
+0.9554829933058333,0.9472245686602775,1.0959246300993313,
+0.9554327272147001,0.9469956731534295,1.0972017823824649,
+0.9556533395035625,0.9466231399592477,1.0988244568263661,
+0.9557989515929564,0.9464090285170748,1.1006314097560101,
+0.9559976223341019,0.9459322640378260,1.1038434861394426,
+0.9565134481740643,0.9459453672837206,1.1077849981956065,
+0.9556740842395858,0.9446729017186131,1.1189773567810644
diff --git a/tests/test_determinist.cpp b/tests/test_determinist.cpp
index 8e0c2497e7c6647b3be44330e85cfd29b192c093..685d3d33ea7167b86ed0875658a96df8426f4168 100644
--- a/tests/test_determinist.cpp
+++ b/tests/test_determinist.cpp
@@ -31,13 +31,7 @@ using namespace xt::placeholders;  // required for `_` to work
 std::vector<std::string> all_metrics_d = {
         "MAE", "MARE", "MSE", "RMSE",
         "NSE", "KGE", "KGE_D", "KGEPRIME", "KGEPRIME_D",
-        // ---------------------------------------------------------------------
-        // TODO: bring back when `xt::argsort` supports stable sorting
-        //       so that the r_spearman component of KGENP and KGENP_D
-        //       yields consistent results across compilers
-        //       https://github.com/xtensor-stack/xtensor/issues/2677
-        // "KGENP", "KGENP_D",
-        // ---------------------------------------------------------------------
+        "KGENP", "KGENP_D",
         "CONT_TBL"
 };