Browse Source

use starpu internal macros for malloc and calloc

Nathalie Furmento 4 years ago
parent
commit
55ea118293

+ 1 - 2
src/core/perfmodel/energy_model.c

@@ -102,8 +102,7 @@ int starpu_energy_start(int workerid, enum starpu_worker_archtype archi)
 
 		nsockets = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_PACKAGE);
 
-		values=calloc(nsockets * N_EVTS,sizeof(long long));
-		STARPU_ASSERT(values);
+		_STARPU_CALLOC(values, nsockets * N_EVTS,sizeof(long long));
 
 		if ((retval = PAPI_library_init(PAPI_VER_CURRENT)) != PAPI_VER_CURRENT)
 			ERROR_RETURN(retval);

+ 1 - 1
src/debug/traces/starpu_fxt.c

@@ -4425,7 +4425,7 @@ void _starpu_fxt_number_events_file_init(struct starpu_fxt_options *options)
 			STARPU_ABORT_MSG("Failed to open '%s' (err %s)", options->number_events_path, strerror(errno));
 
 		/* FUT_SETUP_CODE is the event with the maximal value */
-		number_events = calloc(FUT_SETUP_CODE+1, sizeof(uint64_t));
+		_STARPU_CALLOC(number_events, FUT_SETUP_CODE+1, sizeof(uint64_t));
 	}
 	else
 		number_events_file = NULL;

+ 6 - 3
src/sched_policies/component_heteroprio.c

@@ -434,9 +434,12 @@ static int heteroprio_push_task(struct starpu_sched_component * component, struc
 			/* Didn't find it, add one */
 			data->naccel++;
 
-			float *newaccel = malloc(data->naccel * sizeof(*newaccel));
-			struct _starpu_prio_deque **newbuckets = malloc(data->naccel * sizeof(*newbuckets));
-			struct _starpu_prio_deque *newbucket = malloc(sizeof(*newbucket));
+			float *newaccel;
+			_STARPU_MALLOC(newaccel, data->naccel * sizeof(*newaccel));
+			struct _starpu_prio_deque **newbuckets;
+			_STARPU_MALLOC(newbuckets, data->naccel * sizeof(*newbuckets));
+			struct _starpu_prio_deque *newbucket;
+			_STARPU_MALLOC(newbucket, sizeof(*newbucket));
 			_starpu_prio_deque_init(newbucket);
 			int inserted = 0;
 

+ 3 - 2
tools/starpu_perfmodel_recdump.c

@@ -58,7 +58,8 @@ struct _footprint_list* add_footprint(struct _footprint_list* list, uint32_t foo
 	if(l) return list;
 	else
 	{
-		struct _footprint_list * res = malloc(sizeof(struct _footprint_list));
+		struct _footprint_list *res;
+		_STARPU_MALLOC(res, sizeof(struct _footprint_list));
 		res->footprint = footprint;
 		res->next = list;
 		return res;
@@ -294,7 +295,7 @@ int main(int argc, char **argv)
 					HASH_FIND_STR(models, model_name, model);
 					if (model == NULL)
 					{
-						model = malloc(sizeof(*model));
+						_STARPU_MALLOC(model, sizeof(*model));
 						model->name = model_name;
 						model->footprints = NULL;
 						memset(&model->model, 0, sizeof(model->model));