Thread: [Assorted-commits] SF.net SVN: assorted: [516] numa-bench/trunk/src/chew.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-02-26 20:48:44
|
Revision: 516 http://assorted.svn.sourceforge.net/assorted/?rev=516&view=rev Author: yangzhang Date: 2008-02-26 12:48:46 -0800 (Tue, 26 Feb 2008) Log Message: ----------- removed unnecessary assertion Modified Paths: -------------- numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-02-26 20:31:16 UTC (rev 515) +++ numa-bench/trunk/src/chew.cc 2008-02-26 20:48:46 UTC (rev 516) @@ -231,8 +231,6 @@ << " nnodes " << config.nnodes << endl; - checkmsg(RAND_MAX > config.size / sizeof(int), "PRNG range not large enough"); - void *p = malloc(config.size); check(p != NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-03-07 02:49:01
|
Revision: 616 http://assorted.svn.sourceforge.net/assorted/?rev=616&view=rev Author: yangzhang Date: 2008-03-06 18:49:04 -0800 (Thu, 06 Mar 2008) Log Message: ----------- moved shared pretouching to shared location Modified Paths: -------------- numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-03-07 02:38:20 UTC (rev 615) +++ numa-bench/trunk/src/chew.cc 2008-03-07 02:49:04 UTC (rev 616) @@ -165,6 +165,22 @@ global_sum += sum; } +void +do_pretouch(void *p, const config & config) +{ + if (pretouch) { + int *is = (int*) p; + for (size_t i = 0; i < config.size / sizeof(int); i++) { + is[i] = i; + } + int sum = 0; + for (size_t i = 0; i < config.size / sizeof(int); i++) { + sum += is[i]; + } + global_sum += sum; + } +} + /** * \param pp The start of the buffer to chew. * \param worker From this we can determine which CPU to pin our thread to. @@ -187,17 +203,7 @@ } void* p = config.local ? alloc(config.size) : pp; - if (pretouch) { - int *is = (int*) p; - for (size_t i = 0; i < config.size / sizeof(int); i++) { - is[i] = i; - } - int sum = 0; - for (size_t i = 0; i < config.size / sizeof(int); i++) { - sum += is[i]; - } - global_sum += sum; - } + if (config.local) do_pretouch(p, config); if (debug) { check(pthread_mutex_lock(&iomutex) == 0); cout << worker << " alloc " << p << endl; @@ -288,7 +294,8 @@ check(config.shuffle || config.opcount <= config.size / sizeof(int)); - void *p = malloc(config.size); + void *p = alloc(config.size); + do_pretouch(p, config); check(p != NULL); check(pthread_mutex_init(&iomutex, NULL) == 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-03-10 23:54:19
|
Revision: 619 http://assorted.svn.sourceforge.net/assorted/?rev=619&view=rev Author: yangzhang Date: 2008-03-10 16:54:07 -0700 (Mon, 10 Mar 2008) Log Message: ----------- added conditional numa compilation Modified Paths: -------------- numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-03-10 19:52:06 UTC (rev 618) +++ numa-bench/trunk/src/chew.cc 2008-03-10 23:54:07 UTC (rev 619) @@ -3,7 +3,9 @@ #include <sched.h> +#ifdef HAVE_NUMA #include <numa.h> +#endif #include <boost/bind.hpp> @@ -100,13 +102,21 @@ void * alloc(size_t sz) { +#ifdef HAVE_NUMA return use_numa ? numa_alloc_local(sz) : malloc(sz); +#else + return malloc(sz); +#endif } void dealloc(void *p, size_t sz) { +#ifdef HAVE_NUMA return use_numa ? numa_free(p, sz) : free(p); +#else + return free(p); +#endif } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-03-12 20:44:49
|
Revision: 622 http://assorted.svn.sourceforge.net/assorted/?rev=622&view=rev Author: yangzhang Date: 2008-03-12 13:44:56 -0700 (Wed, 12 Mar 2008) Log Message: ----------- ported to tile64 Modified Paths: -------------- numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-03-12 20:41:57 UTC (rev 621) +++ numa-bench/trunk/src/chew.cc 2008-03-12 20:44:56 UTC (rev 622) @@ -1,6 +1,7 @@ #include <fstream> #include <iostream> +#include <pthread.h> #include <sched.h> #ifdef HAVE_NUMA @@ -8,6 +9,7 @@ #endif #include <boost/bind.hpp> +#include <boost/scoped_array.hpp> #include <commons/check.h> #include <commons/rand.h> @@ -15,12 +17,19 @@ #include <commons/time.h> #include <commons/boost/threads.h> +#ifdef TILE64 +#include <commons/pthread/barrier.h> +#endif + using namespace boost; using namespace commons; using namespace std; // TODO Make into command line flags? -const bool debug = false, pretouch = true, do_warmup = false, use_numa = false; +const bool debug = false, pretouch = true, do_warmup = false; +#ifdef HAVE_NUMA +const bool use_numa = false; +#endif pthread_barrier_t cross_barrier, startup_barrier; pthread_mutex_t iomutex; void*** partitions; @@ -321,7 +330,7 @@ if (config.par) { // Chew the memory area from each core in parallel (and also chew own). - pthread_t ts[config.nworkers]; + scoped_array<pthread_t> ts(new pthread_t[config.nworkers]); check(0 == pthread_barrier_init(&cross_barrier, NULL, config.nworkers)); check(0 == pthread_barrier_init(&startup_barrier, NULL, config.nworkers)); for (unsigned int i = 0; i < config.nworkers; i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-03-13 16:29:28
|
Revision: 624 http://assorted.svn.sourceforge.net/assorted/?rev=624&view=rev Author: yangzhang Date: 2008-03-13 09:13:33 -0700 (Thu, 13 Mar 2008) Log Message: ----------- fixed no-par/barrier bug Modified Paths: -------------- numa-bench/trunk/src/chew.cc Modified: numa-bench/trunk/src/chew.cc =================================================================== --- numa-bench/trunk/src/chew.cc 2008-03-13 15:53:06 UTC (rev 623) +++ numa-bench/trunk/src/chew.cc 2008-03-13 16:13:33 UTC (rev 624) @@ -228,7 +228,7 @@ cout << worker << " alloc " << p << endl; check(pthread_mutex_unlock(&iomutex) == 0); } - if (!warmup) { + if (!warmup && config.par) { int barrier_result = pthread_barrier_wait(&startup_barrier); check(barrier_result == PTHREAD_BARRIER_SERIAL_THREAD || barrier_result == 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |