Browse Source

merge trunk up to r11088

Nathalie Furmento 12 years ago
parent
commit
98b4469b6a
2 changed files with 17 additions and 11 deletions
  1. 4 2
      src/drivers/driver_common/driver_common.c
  2. 13 9
      tests/disk/disk_copy.c

+ 4 - 2
src/drivers/driver_common/driver_common.c

@@ -219,9 +219,13 @@ struct starpu_task *_starpu_get_worker_task(struct _starpu_worker *args, int wor
 		_starpu_worker_set_status_sleeping(workerid);
 
 		if (_starpu_worker_can_block(memnode))
+		{
 			STARPU_PTHREAD_COND_WAIT(&args->sched_cond, &args->sched_mutex);
+			STARPU_PTHREAD_MUTEX_UNLOCK(&args->sched_mutex);
+		}
 		else
 		{
+			STARPU_PTHREAD_MUTEX_UNLOCK(&args->sched_mutex);			
 			if (_starpu_machine_is_running())
 			{
 				_starpu_exponential_backoff(args);
@@ -237,8 +241,6 @@ struct starpu_task *_starpu_get_worker_task(struct _starpu_worker *args, int wor
 			}
 		}
 
-		STARPU_PTHREAD_MUTEX_UNLOCK(&args->sched_mutex);
-
 #ifdef STARPU_USE_SC_HYPERVISOR
 		struct _starpu_sched_ctx *sched_ctx = NULL;
 		struct starpu_sched_ctx_performance_counters *perf_counters = NULL;

+ 13 - 9
tests/disk/disk_copy.c

@@ -22,11 +22,15 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
+#include <common/config.h>
+#include "../helper.h"
 
 /* size of one vector */
+#if SIZEOF_VOID_P == 4
+#define	NX	(30*1000/sizeof(double))
+#else
 #define	NX	(30*1000000/sizeof(double))
-#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
-
+#endif
 
 int main(int argc, char **argv)
 {
@@ -44,7 +48,7 @@ int main(int argc, char **argv)
 	int new_dd = starpu_disk_register(&starpu_disk_stdio_ops, (void *) "/tmp", 1024*1024*200);
 	/* can't write on /tmp/ */
 	if (new_dd == -ENOENT) goto enoent;
-	
+
 	unsigned dd = (unsigned) new_dd;
 
 	/* allocate two memory spaces */
@@ -60,12 +64,12 @@ int main(int argc, char **argv)
 		A[j] = j;
 		F[j] = -j;
 	}
-	
+
 	starpu_data_handle_t vector_handleA, vector_handleB, vector_handleC, vector_handleD, vector_handleE, vector_handleF;
 
 	/* register vector in starpu */
 	starpu_vector_data_register(&vector_handleA, STARPU_MAIN_RAM, (uintptr_t)A, NX, sizeof(double));
-	starpu_vector_data_register(&vector_handleB, -1, (uintptr_t) NULL, NX, sizeof(double));	
+	starpu_vector_data_register(&vector_handleB, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleC, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleD, -1, (uintptr_t) NULL, NX, sizeof(double));
 	starpu_vector_data_register(&vector_handleE, -1, (uintptr_t) NULL, NX, sizeof(double));
@@ -88,13 +92,13 @@ int main(int argc, char **argv)
 	starpu_data_unregister(vector_handleD);
 	starpu_data_unregister(vector_handleE);
 	starpu_data_unregister(vector_handleF);
-	
+
 	/* check if computation is correct */
 	int try = 1;
 	for (j = 0; j < NX; ++j)
 		if (A[j] != F[j])
 		{
-			printf("Fail A %f != F %f \n", A[j], F[j]);
+			FPRINTF(stderr, "Fail A %f != F %f \n", A[j], F[j]);
 			try = 0;
 		}
 
@@ -112,7 +116,7 @@ int main(int argc, char **argv)
 	return (try ? EXIT_SUCCESS : EXIT_FAILURE);
 
 enodev:
-	return 77;
+	return STARPU_TEST_SKIPPED;
 enoent:
-	return 77;
+	return STARPU_TEST_SKIPPED;
 }