Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
On some systems, sqrt(int) is not defined properly. On others its just implemented...
authorAugustin Degomme <adegomme@gmail.com>
Mon, 13 May 2019 08:26:16 +0000 (10:26 +0200)
committerAugustin Degomme <adegomme@gmail.com>
Tue, 14 May 2019 10:03:50 +0000 (12:03 +0200)
src/smpi/colls/allgather/allgather-2dmesh.cpp
src/smpi/colls/alltoall/alltoall-2dmesh.cpp
src/smpi/mpi/smpi_topo.cpp

index 0cfecd0..cb7ed51 100644 (file)
@@ -69,7 +69,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 static int is_2dmesh(int num, int *i, int *j)
 {
   int x, max = num / 2;
-  x = sqrt(num);
+  x = sqrt(double(num));
 
   while (x <= max) {
     if ((num % x) == 0) {
index f9c7f09..7d9a906 100644 (file)
@@ -33,7 +33,7 @@
 static int alltoall_check_is_2dmesh(int num, int *i, int *j)
 {
   int x, max = num / 2;
-  x = sqrt(num);
+  x = sqrt(double(num));
 
   while (x <= max) {
     if ((num % x) == 0) {
index 83b5147..3376a52 100644 (file)
@@ -387,8 +387,8 @@ static int getfactors(int num, int *nfactors, int **factors) {
     return MPI_SUCCESS;
   }
   /* Allocate the array of prime factors which cannot exceed log_2(num) entries */
-  int sqrtnum = ceil(sqrt(num));
-  int size = ceil(log(num) / log(2));
+  int sqrtnum = ceil(sqrt(double(num)));
+  int size = ceil(log(double(num)) / log(2.0));
   *factors = new int[size];
 
   int i = 0;