Browse Source

Fortran seems to dislike weak definitions

mpi/examples/native_fortran/nf_* were crashing
Samuel Thibault 5 years ago
parent
commit
81a4a24cfe
1 changed files with 12 additions and 6 deletions
  1. 12 6
      src/common/utils.c

+ 12 - 6
src/common/utils.c

@@ -517,11 +517,7 @@ char *_starpu_get_home_path(void)
 }
 
 #pragma weak starpu_mpi_world_rank
-int starpu_mpi_world_rank()
-{
-	_STARPU_DISP("StarPU-MPI unavailable, the rank of this process is 0");
-	return 0;
-}
+extern int starpu_mpi_world_rank(void);
 
 void _starpu_gethostname(char *hostname, size_t size)
 {
@@ -532,7 +528,17 @@ void _starpu_gethostname(char *hostname, size_t size)
 	{
 		char *host, *srv_hosts, *rsrv;
 		srv_hosts = strdup(force_mpi_hostnames);
-		int rank = starpu_mpi_world_rank();
+		int rank;
+		if (starpu_mpi_world_rank)
+		{
+			rank = starpu_mpi_world_rank();
+		}
+		else
+		{
+			_STARPU_DISP("StarPU-MPI unavailable, the rank of this process is 0");
+			rank = 0;
+		}
+
 		if (force_mpi_hostnames != NULL)
 		{
 			host = strtok_r(srv_hosts, " ", &rsrv);