The Gem5 SE mode is bare-metal fashion to run standard applications in
absence of any OS. If we want to run a program in parallel, using POSIX
thread or OpenMP, it is not possible to execute parallel-applications in
bare-metal SE MODE.

On Mon, Oct 4, 2021 at 4:15 PM VIPIN PATEL via gem5-users <
gem5-users@gem5.org> wrote:

> Hi Krishan,
>
> I also faced a similar issue while executing the pthread program in SE
> mode. It seems the number of core should be equal to the maximum number of
> core you are trying to execute.
> For example: If you are launching 4 thread with pthread_create, the number
> of cores should be at least 5 (4 cores: one for each thread + 1 core for
> master thread).
>
> Hope it helps.
>
> Regards,
> Vipin
>
> On Mon, Aug 23, 2021 at 9:55 PM krishnan gosakan via gem5-users <
> gem5-users@gem5.org> wrote:
>
>> I am facing a new problem with running multithreaded applications
>> compiled with m5threads on gem5 in SE mode.
>> The application I am using has 4 threads and all 4 threads work on the
>> same function. The application is a breadth first search algorithm which
>> works on a large graph.
>> So, I have 4 threads which do bfs independently. When I run this in gem5
>> SE mode, I see that the first thread is created and it does all the bfs
>> work and the remaining 3 threads just get created and the program exits (I
>> mean they don't do any work in the bfs function).
>> I see this is something similar to sequential execution.
>> I guess I am missing some command line argument but can't find what it is.
>> I am using the default CPU which is AtomicSimpleCPU (as I don't use cpu
>> argument) and use 4 cores (as I have 4 threads).
>> Any help would be appreciated.
>>
>> On Sat, Aug 7, 2021 at 9:10 PM Hossein Golestani <hosse...@umich.edu>
>> wrote:
>>
>>> Hi Krishnan,
>>>
>>> The SE mode does not have any thread scheduler. You should have as many
>>> cores as the maximum number threads your program may launch. In your
>>> example, since your program has two threads, two cores are needed, each
>>> running of the threads.
>>>
>>> Thanks,
>>> Hossein
>>>
>>>
>>> On Fri, Aug 6, 2021 at 5:16 AM krishnan gosakan <
>>> krishnan.gosa...@gmail.com> wrote:
>>>
>>>> Seems like this problem arise only when number of cores is set to 1.
>>>> When I increase the number of cores, I see that pthread_join is working
>>>> perfectly.
>>>> Not sure if this is kind of a limitation.
>>>> Any idea?
>>>>
>>>> On Fri, Aug 6, 2021 at 11:16 AM krishnan gosakan <
>>>> krishnan.gosa...@gmail.com> wrote:
>>>>
>>>>> Hi Hossein,
>>>>> I used the m5thread_x86.o file and compiled my sample code (attached
>>>>> with this mail). I used the following 2 commands to build my file
>>>>>
>>>>> gcc -g -O3 -c -o semodePthread.o semodePthread.c
>>>>> gcc -static -o semodePthread semodePthread.o m5threads_x86.o
>>>>>
>>>>> By running semodePthread in gem5 se mode, I see that pthread_create is
>>>>> succeeding but it gets stuck in pthread_join. Also I see printf in thread
>>>>> function is not running.
>>>>> Am I missing something? Or am I building it wrong?
>>>>> ANy suggestions would be greatly appreciated.
>>>>>
>>>>> On Mon, Jul 26, 2021 at 2:03 AM Hossein Golestani <hosse...@umich.edu>
>>>>> wrote:
>>>>>
>>>>>> [I'm resending my reply without the attachments in case they caused
>>>>>> it to get into the spam folder.]
>>>>>>
>>>>>> Hi Krishnan,
>>>>>>
>>>>>> I remember that I also failed to build m5threads on a particular
>>>>>> system, but I managed to build it on another system with a relatively old
>>>>>> config (I have attached the output m5threads object files for x86 and ARM
>>>>>> v7 to this email). If I remember correctly, that system had the Linux
>>>>>> kernel 3.19 and gcc 4.8. You should be able to link the attached object
>>>>>> file to your multi-threaded program compiled on a system with a newer
>>>>>> kernel/compiler. Hope this helps.
>>>>>>
>>>>>> Thanks,
>>>>>> Hossein
>>>>>>
>>>>>>
>>>>>> On Sat, Jul 24, 2021 at 11:24 PM krishnan gosakan <
>>>>>> krishnan.gosa...@gmail.com> wrote:
>>>>>>
>>>>>>> Hi Hossein,
>>>>>>> I tried building m5threads but it failed. What system configuration
>>>>>>> are you using to build m5threads?
>>>>>>> What kernel version do you use and what compiler do you use?
>>>>>>>
>>>>>>> On Sat, Jul 24, 2021 at 10:28 PM Hossein Golestani <
>>>>>>> hosse...@umich.edu> wrote:
>>>>>>>
>>>>>>>> Hi Krishnan,
>>>>>>>>
>>>>>>>> I use m5threads, which is a light-weight alternative for
>>>>>>>> pthread, to simulate multi-threaded programs in the SE mode:
>>>>>>>> https://github.com/gem5/m5threads
>>>>>>>> (I'm not sure if there are any other ways.)
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Hossein
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Jul 24, 2021 at 11:00 AM krishnan gosakan via gem5-users <
>>>>>>>> gem5-users@gem5.org> wrote:
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>> I am trying to run a code with pthread in gem5 se mode. The code
>>>>>>>>> runs perfectly when launched from command prompt but pthread_create 
>>>>>>>>> returns
>>>>>>>>> error code 11 when run in se mode. Is there anything special I should 
>>>>>>>>> do to
>>>>>>>>> make pthread run in se mode. From the tests directory, I see that C++
>>>>>>>>> std::thread is running perfectly in gem5 se mode. Any help would be
>>>>>>>>> appreciated.
>>>>>>>>> Thank you.
>>>>>>>>>
>>>>>>>>> Sample code I use in gem5 se mode
>>>>>>>>>
>>>>>>>>> #include <stdio.h>
>>>>>>>>> #include <pthread.h>
>>>>>>>>>
>>>>>>>>> void *doWork1(void *arg)
>>>>>>>>> {
>>>>>>>>>     for (int i=0; i<1000000000; i++)
>>>>>>>>>         ;
>>>>>>>>>     printf("work completed\n");
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> int main()
>>>>>>>>> {
>>>>>>>>>     pthread_t thread;
>>>>>>>>>     int error = pthread_create(&thread, NULL, doWork1, NULL);
>>>>>>>>>     if (error == 0)
>>>>>>>>>     {
>>>>>>>>>         printf("thread created\n");
>>>>>>>>>         pthread_join(thread, NULL);
>>>>>>>>>         printf("thread work complete\n");
>>>>>>>>>     }
>>>>>>>>>     else
>>>>>>>>>     {
>>>>>>>>>         printf("error in thread creation %d\n",error);
>>>>>>>>>     }
>>>>>>>>>     return 0;
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>> Krishnan.
>>>>>>>>> _______________________________________________
>>>>>>>>> gem5-users mailing list -- gem5-users@gem5.org
>>>>>>>>> To unsubscribe send an email to gem5-users-le...@gem5.org
>>>>>>>>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Krishnan.
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Krishnan.
>>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Krishnan.
>>>>
>>>
>>
>> --
>> Regards,
>> Krishnan.
>> _______________________________________________
>> gem5-users mailing list -- gem5-users@gem5.org
>> To unsubscribe send an email to gem5-users-le...@gem5.org
>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to