Browse Source

Avoid exit()ing due to missing papi support

Samuel Thibault 4 years ago
parent
commit
23bad8e70f
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/core/perfmodel/energy_model.c

+ 4 - 3
src/core/perfmodel/energy_model.c

@@ -114,7 +114,8 @@ int starpu_energy_start(int workerid, enum starpu_worker_archtype archi)
 		{
 			/* return the index of socket */
 			hwloc_obj_t obj = hwloc_get_obj_by_type(topology, HWLOC_OBJ_PACKAGE, i);
-			add_event(EventSet, obj->os_index);
+			if ( (retval = add_event(EventSet, obj->os_index)) != PAPI_OK)
+				ERROR_RETURN(retval);
 		}
 
 		/* get the number of events in the event set */
@@ -271,8 +272,8 @@ static int add_event(int eventSet, int socket)
 			retval = PAPI_add_named_event(eventSet, buf);
 			if(retval != PAPI_OK)
 			{
-				printf("cannot add event\n");
-				exit (1);
+				printf("cannot add event '%s'\n", buf);
+				return retval;
 			}
 		}
 	}