/****************************************************************************** * Getting Started with m5threads @ LaCASA Laboratory (lacasa.uah.edu) * This tutorial should help you get started with m5threads on computers in LaCASA lab. * It is tested on eb245-mhealth3 machine that runs 64-bit CentOS 6.3 OS. * Author: Aleksandar Milenkovic * Date: March 2014 ******************************************************************************/ 1. Preparation ============== Go to the directory where you want m5threads installed. 2. Download m5threds ==================== Use hg clone command as follows. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [milenka@EB245-mhealth3 ~]$ hg clone http://repo.gem5.org/m5threads destination directory: m5threads requesting all changes adding changesets adding manifests adding file changes added 9 changesets with 40 changes to 22 files updating to branch default 22 files updated, 0 files merged, 0 files removed, 0 files unresolved >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Your should see the following. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [milenka@EB245-mhealth3 ~]$ cd m5threads/ [milenka@EB245-mhealth3 m5threads]$ ls LICENSE profiling_hooks.h pthread_defs.h spinlock_alpha.h spinlock_sparc.h tests Makefile pthread.c README spinlock_arm.h spinlock_x86.h tls_defs.h >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 3. Compile libpthread ===================== <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [milenka@EB245-mhealth3 m5threads]$ make gcc -O3 -static -c -o pthread.o pthread.c ar rv libpthread.a pthread.o ar: creating libpthread.a a - pthread.o rm pthread.o >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 4. Compile tests ================= <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [milenka@EB245-mhealth3 m5threads]$ cd tests/ [milenka@EB245-mhealth3 tests]$ ls Makefile test_barrier.cpp test_malloc.cpp test_pthreadbasic.cpp test_sieve.cpp test___thread.cpp test_atomic.cpp test_lock.cpp test_omp.cpp test_pthread.cpp test_stackgrow.cpp [milenka@EB245-mhealth3 tests]$ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Edit Makefile for x86 target. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # 64-bit compiles #Uncomment to use sparc/alpha cross-compilers #CC := sparc64-unknown-linux-gnu-gcc #CPP := sparc64-unknown-linux-gnu-g++ #CC := alpha-unknown-linux-gnu-gcc #CPP := alpha-unknown-linux-gnu-g++ CC := arm-linux-gnueabi-gcc CPP := arm-linux-gnueabi-g++ #CC := gcc #CPP := g++ ... CFLAGS := -g -O3 $(ARM_FLAGS) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> to <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # 64-bit compiles #Uncomment to use sparc/alpha cross-compilers #CC := sparc64-unknown-linux-gnu-gcc #CPP := sparc64-unknown-linux-gnu-g++ #CC := alpha-unknown-linux-gnu-gcc #CPP := alpha-unknown-linux-gnu-g++ #CC := arm-linux-gnueabi-gcc #CPP := arm-linux-gnueabi-g++ CC := gcc CPP := g++ CFLAGS := -g -O3 #$(ARM_FLAGS) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Compile the tests for x86: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [milenka@EB245-mhealth3 tests]$ make Makefile:50: warning: overriding commands for target `test_omp' Makefile:42: warning: ignoring old commands for target `test_omp' g++ -g -O3 -c -o test_stackgrow.o test_stackgrow.cpp g++ -g -O3 -c -o test_pthreadbasic.o test_pthreadbasic.cpp g++ -g -O3 -c -o test_pthread.o test_pthread.cpp g++ -g -O3 -c -o test_atomic.o test_atomic.cpp g++ -g -O3 -c -o test_barrier.o test_barrier.cpp g++ -g -O3 -c -o test_lock.o test_lock.cpp g++ -g -O3 -c -o test_malloc.o test_malloc.cpp g++ -g -O3 -c -o test_sieve.o test_sieve.cpp g++ -g -O3 -c -o test___thread.o test___thread.cpp gcc -g -O3 -c ../pthread.c -o ../pthread.o g++ -g -O3 -fopenmp -c -o test_omp.o test_omp.cpp g++ -static -o test_stackgrow test_stackgrow.o ../pthread.o g++ -static -o test_stackgrow_p test_stackgrow.o -lpthread g++ -static -o test_pthreadbasic test_pthreadbasic.o ../pthread.o g++ -static -o test_pthreadbasic_p test_pthreadbasic.o -lpthread .... (You may see some warnings) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 5. Run a test ============= <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< [milenka@EB245-mhealth3 tests]$ ./test_atomic 4 Init done [Iteration 1, Thread 2] Got lock [Iteration 1, Thread 2] Critical section done, previously next=0, now next=2 [Iteration 1, Thread 3] Got lock [Iteration 1, Thread 3] Critical section done, previously next=2, now next=3 .... Iteration 10 completed PASSED :-) [milenka@EB245-mhealth3 tests]$ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>