Browse Source

Merge branch 'master' into python-test

HE Kun 4 years ago
parent
commit
9c25f16f32
3 changed files with 28 additions and 13 deletions
  1. 4 0
      mpi/include/starpu_mpi.h
  2. 3 0
      mpi/src/starpu_mpi.c
  3. 21 13
      src/core/perfmodel/perfmodel_history.c

+ 4 - 0
mpi/include/starpu_mpi.h

@@ -197,6 +197,8 @@ int starpu_mpi_send_prio(starpu_data_handle_t data_handle, int dest, starpu_mpi_
    Perform a standard-mode, blocking receive in \p data_handle from
    the node \p source using the message tag \p data_tag within the
    communicator \p comm.
+   The value of \p status cannot be NULL, use the predefined value
+   MPI_STATUS_IGNORE to ignore the status.
 */
 int starpu_mpi_recv(starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, MPI_Status *status);
 
@@ -277,6 +279,8 @@ int starpu_mpi_issend_detached_prio(starpu_data_handle_t data_handle, int dest,
 
 /**
    Return when the operation identified by request \p req is complete.
+   The value of \p status cannot be NULL, use the predefined value
+   MPI_STATUS_IGNORE to ignore the status.
 */
 int starpu_mpi_wait(starpu_mpi_req *req, MPI_Status *status);
 

+ 3 - 0
mpi/src/starpu_mpi.c

@@ -348,6 +348,8 @@ int starpu_mpi_irecv_detached_sequential_consistency(starpu_data_handle_t data_h
 
 int starpu_mpi_recv(starpu_data_handle_t data_handle, int source, starpu_mpi_tag_t data_tag, MPI_Comm comm, MPI_Status *status)
 {
+	STARPU_ASSERT_MSG(status != NULL || status == MPI_STATUS_IGNORE, "MPI_Status value cannot be NULL or different from MPI_STATUS_IGNORE");
+
 	starpu_mpi_req req;
 
 	_STARPU_MPI_LOG_IN();
@@ -361,6 +363,7 @@ int starpu_mpi_recv(starpu_data_handle_t data_handle, int source, starpu_mpi_tag
 
 int starpu_mpi_wait(starpu_mpi_req *public_req, MPI_Status *status)
 {
+	STARPU_ASSERT_MSG(status != NULL || status == MPI_STATUS_IGNORE, "MPI_Status value cannot be NULL or different from MPI_STATUS_IGNORE");
 	return _mpi_backend._starpu_mpi_backend_wait(public_req, status);
 }
 

+ 21 - 13
src/core/perfmodel/perfmodel_history.c

@@ -196,7 +196,7 @@ struct starpu_perfmodel_arch *starpu_perfmodel_arch_comb_fetch(int comb)
 	return arch_combs[comb];
 }
 
-size_t _starpu_job_get_data_size(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, unsigned impl, struct _starpu_job *j)
+static size_t __starpu_job_get_data_size(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, unsigned impl, struct _starpu_job *j)
 {
 	struct starpu_task *task = j->task;
 	int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
@@ -224,6 +224,17 @@ size_t _starpu_job_get_data_size(struct starpu_perfmodel *model, struct starpu_p
 	}
 }
 
+size_t _starpu_job_get_data_size(struct starpu_perfmodel *model, struct starpu_perfmodel_arch* arch, unsigned impl, struct _starpu_job *j)
+{
+	size_t ret;
+	if (model)
+		STARPU_PTHREAD_RWLOCK_RDLOCK(&model->state->model_rwlock);
+	ret = __starpu_job_get_data_size(model, arch, impl, j);
+	if (model)
+		STARPU_PTHREAD_RWLOCK_UNLOCK(&model->state->model_rwlock);
+	return ret;
+}
+
 /*
  * History based model
  */
@@ -1587,13 +1598,11 @@ double _starpu_regression_based_job_expected_perf(struct starpu_perfmodel *model
 	struct starpu_perfmodel_regression_model *regmodel = NULL;
 
 	comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
-	size = _starpu_job_get_data_size(model, arch, nimpl, j);
-
-	if(comb == -1)
-		goto docal;
 
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&model->state->model_rwlock);
-	if (model->state->per_arch[comb] == NULL)
+	size = __starpu_job_get_data_size(model, arch, nimpl, j);
+
+	if (comb == -1 || model->state->per_arch[comb] == NULL)
 	{
 		// The model has not been executed on this combination
 		STARPU_PTHREAD_RWLOCK_UNLOCK(&model->state->model_rwlock);
@@ -1629,13 +1638,12 @@ double _starpu_non_linear_regression_based_job_expected_perf(struct starpu_perfm
 	struct starpu_perfmodel_regression_model *regmodel;
 	struct starpu_perfmodel_history_table *entry = NULL;
 
-	size = _starpu_job_get_data_size(model, arch, nimpl, j);
 	comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
-	if(comb == -1)
-		goto docal;
 
 	STARPU_PTHREAD_RWLOCK_RDLOCK(&model->state->model_rwlock);
-	if (model->state->per_arch[comb] == NULL)
+	size = __starpu_job_get_data_size(model, arch, nimpl, j);
+
+	if (comb == -1 || model->state->per_arch[comb] == NULL)
 	{
 		// The model has not been executed on this combination
 		STARPU_PTHREAD_RWLOCK_UNLOCK(&model->state->model_rwlock);
@@ -1919,7 +1927,7 @@ void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfm
 					entry->mean = measured;
 				}
 
-				entry->size = _starpu_job_get_data_size(model, arch, impl, j);
+				entry->size = __starpu_job_get_data_size(model, arch, impl, j);
 				entry->flops = j->task->flops;
 
 				entry->footprint = key;
@@ -1985,7 +1993,7 @@ void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfm
 			reg_model = &per_arch_model->regression;
 
 			/* update the regression model */
-			size_t job_size = _starpu_job_get_data_size(model, arch, impl, j);
+			size_t job_size = __starpu_job_get_data_size(model, arch, impl, j);
 			double logy, logx;
 			logx = log((double)job_size);
 			logy = log(measured);
@@ -2051,7 +2059,7 @@ void _starpu_update_perfmodel_history(struct _starpu_job *j, struct starpu_perfm
 
 		STARPU_ASSERT(j->footprint_is_computed);
 
-		fprintf(f, "0x%x\t%lu\t%f\t%f\t%f\t%u\t\t", j->footprint, (unsigned long) _starpu_job_get_data_size(model, arch, impl, j), measured, task->predicted, task->predicted_transfer, cpuid);
+		fprintf(f, "0x%x\t%lu\t%f\t%f\t%f\t%u\t\t", j->footprint, (unsigned long) __starpu_job_get_data_size(model, arch, impl, j), measured, task->predicted, task->predicted_transfer, cpuid);
 		unsigned i;
 		unsigned nbuffers = STARPU_TASK_GET_NBUFFERS(task);