Hi Mohammad,

If you're running a pthreads application in SE mode, you'll need at least 1
CPU per thread (since there is no thread scheduler). In this case, you
actually have 3 threads (the main thread, and the two created via
pthread_create). If you try with --num-cpus=3 it *should* work.

-- 
Matt Poremba
Ph.D. Candidate
111N IST Building
Pennsylvania State University
University Park, PA 16802
Phone: 814-689-9447
Email: [email protected]


On Fri, Feb 22, 2013 at 10:10 AM, Alshamlan, Mohammad <[email protected]>wrote:

> Hi everybody,
>
> I don't understand what is going wrong with my code, complier, or gem5
> version. I'm  using the stable version. Okay, before I go any further let
> me show the host kernel. The output of uname -a as follows "Linux
> alshamlan-Precision-T1500 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11
> 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux"
>
> Now, this my C Code:
> *#include <stdio.h>
> #include <pthread.h>
> main()  {
>   pthread_t f2_thread, f1_thread;
>   void *f2(), *f1();
>   pthread_create(&f1_thread,NULL,f1,NULL);
>   pthread_create(&f2_thread,NULL,f2,NULL);
>   pthread_join(f1_thread,NULL);
>   pthread_join(f2_thread,NULL);
> }
> void *f1(){
>   printf("Hello World");
>   pthread_exit(0);
> }
> void *f2(){
>   printf(" -- 2 threads\n");
>   pthread_exit(0);
> }
> *
>
> And I compiled it this way:
> *gcc -ggdb3 -O3 -D__DEBUG -c hello_2threds.c -o hello_pthread.o*
>
> Linking it:
> *g++ -static -o test_hello_pthread hello_pthread.o ../pthread.o *
>
> After the code has compiled and linked, I used this command in gem5:
> *build/X86/gem5.opt configs/example/se.py --cpu-type=detailed
> --num-cpus=2 --clock=1.8GHz --caches --l2cache --l1d_size=32kB
> --l1i_size=32kB --l2_size=2MB --l3_size=16MB --l1d_assoc=2 --l1i_assoc=2
> --l2_assoc=8 --l3_assoc=16 --cacheline_size=64 -c
> /home/alshamlan/Documents/different_prograing_languages/test_hello_pthread
>  *
>
> --
> Best Regards,
> Mohammad Alshamlan
> FIU Panther ID: 3485580
>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to