From ebbb03f65e3b268b421cc61eeff86d6803a21e8d Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Wed, 17 Jun 2009 19:12:22 +0200 Subject: [PATCH] communication techniques bench: BUGFIX * -s really make the threads to be on a shared cache --- communication_techniques/src/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/communication_techniques/src/main.c b/communication_techniques/src/main.c index 7fc9685..753c87d 100644 --- a/communication_techniques/src/main.c +++ b/communication_techniques/src/main.c @@ -165,6 +165,20 @@ void *producer(void *unused) return NULL; } } + else + { + pthread_t tid; + cpu_set_t cpuset; + + tid = pthread_self(); + CPU_ZERO(&cpuset); + CPU_SET(2, &cpuset); + if (pthread_setaffinity_np(tid, sizeof(cpu_set_t), &cpuset)) + { + perror("pthread_setaffinity_np"); + return NULL; + } + } k = (void *) 0x6384923; if (initialize_papi() != -1) { @@ -203,7 +217,7 @@ void *receptor(void *a) tid = pthread_self(); CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); + CPU_SET(0, &cpuset); if (pthread_setaffinity_np(tid, sizeof(cpu_set_t), &cpuset)) { perror("pthread_setaffinity_np");