Hi,

Please find enclosed the script file and the program code for matrix 
multiplication which I tried.

On running gem5 binary with --version option I get
"Gem5.opt 2.0".

I tried running a simple hello world program with se.py and got the same error. 
This is the command line I used for it
../gem5/build/ARM/gem5.opt ../gem5/configs/example/se.py 
--cpu-type=TimingSimpleCPU --num-cpus=4 --num-work-ids=3 -c hello3 --caches 
--l1d_size=2kB --l1i_size=2kB --l2cache --l2_size=2kB 

But if I use DerivO3CPU it works fine.

Best
Gagan

-----Original Message-----
From: gem5-users [mailto:gem5-users-boun...@gem5.org] On Behalf Of Ciro Santilli
Sent: Tuesday, 17 April 2018 10:04
To: gem5 users mailing list <gem5-users@gem5.org>
Subject: Re: [gem5-users] Multi-threading on ARM timing CPU

On Tue, Apr 17, 2018 at 8:10 AM, Singh, G. <g.si...@tue.nl> wrote:
> Hi All,
>
>
>
> I am trying to run a simple multi-threaded program on ARM processor 
> with 4 cpu's and 4 threads.
>
> This program works perfectly for DerivO3CPU but the same program on 
> timing model gives the errors given
>
> below.  Actually I get the correct result but the program run does not 
> complete.
>

Please provide the following:

- gem5 version (git SHA)
- full gem5 command line
- how to obtain the required blobs (rootfs, dtb, etc.)

What program are you running? Does it fail on every multithreaded program, or 
just this partiular one? Can you produce a minimal single C file example that 
also fails and give us the source?

>
>
> Also, is there an option to simulate multithreaded code with each 
> thread on different processor using se.py?
>

Please ask one question per email in the future to make answers more reusable 
for other people. ;-) (I don't know the answer to this one
yet)

> Right now I am writing a new script file.
>
>
>
> gem5.opt: build/ARM/cpu/simple/timing.cc:237: virtual void
> TimingSimpleCPU::suspendContext(ThreadID): Assertion `_status == 
> BaseSimpleCPU::Running' failed.
>
> Program aborted at tick 4576216124000
>
> --- BEGIN LIBC BACKTRACE ---
>
> ../../tools/gem5/build/ARM/gem5.opt(_Z15print_backtracev+0x28)[0xb05d2
> 8]
>
> ../../tools/gem5/build/ARM/gem5.opt(_Z12abortHandleri+0x46)[0xb24396]
>
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7efd25543390]
>
> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7efd24269428]
>
> /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7efd2426b02a]
>
> /lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x7efd24261bd7]
>
> /lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7efd24261c82]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN15TimingSimpleCPU14suspendConte
> xtEs+0x335)[0xfe1035]
>
> ../../tools/gem5/build/ARM/gem5.opt(_Z13exitGroupFuncP11SyscallDesciP1
> 1LiveProcessP13ThreadContext+0x57)[0xb85677]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN11SyscallDesc9doSyscallEiP11Liv
> eProcessP13ThreadContext+0xa8)[0xb8afe8]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN11LiveProcess7syscallElP13Threa
> dContext+0x49)[0xb7bc09]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN6ArmISA14SupervisorCall6invokeE
> P13ThreadContextRK14RefCountingPtrI10StaticInstE+0x6a)[0xd8317a]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN13BaseSimpleCPU9advancePCERKSt1
> 0shared_ptrI9FaultBaseE+0x104)[0xfe27a4]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN15TimingSimpleCPU11advanceInstE
> RKSt10shared_ptrI9FaultBaseE+0x39)[0xfded49]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN15TimingSimpleCPU14completeIfet
> chEP6Packet+0x1d9)[0xfdf149]
>
> ../../tools/gem5/build/ARM/gem5.opt(_ZN10EventQueue10serviceOneEv+0xb1
> )[0xb14a21]
>
> ../../tools/gem5/build/ARM/gem5.opt(_Z9doSimLoopP10EventQueue+0x50)[0x
> b42020]
>
> ../../tools/gem5/build/ARM/gem5.opt(_Z8simulatem+0x203)[0xb425f3]
>
> ../../tools/gem5/build/ARM/gem5.opt[0x1053802]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x785
> 2)[0x7efd25800772]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x85c)
> [0x7efd2593705c]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6ff
> d)[0x7efd257fff1d]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x712
> 4)[0x7efd25800044]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x712
> 4)[0x7efd25800044]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x85c)
> [0x7efd2593705c]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x19)[0x
> 7efd257f8da9]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x613
> b)[0x7efd257ff05b]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x85c)
> [0x7efd2593705c]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6ff
> d)[0x7efd257fff1d]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x85c)
> [0x7efd2593705c]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x19)[0x
> 7efd257f8da9]
>
> /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyRun_StringFlags+0x76)[
> 0x7efd258731f6]
>
> --- END LIBC BACKTRACE ---
>
> Aborted (core dumped)
>
>
>
> Best
>
> Gagan
>
>
> _______________________________________________
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Attachment: armInOrder.py
Description: armInOrder.py

#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

#define NRA 64                /* number of rows in matrix A */
#define NCA 64                 /* number of columns in matrix A */
#define NCB 64                  /* number of columns in matrix B */

int main (int argc, char *argv[]) 
{
int     tid, nthreads, i, j, k, chunk;
double  a[NRA][NCA],           /* matrix A to be multiplied */
        b[NCA][NCB],           /* matrix B to be multiplied */
        c[NRA][NCB];           /* result matrix C */

chunk = 10;                    /* set loop iteration chunk size */

/*** Spawn a parallel region explicitly scoping all variables ***/
omp_set_num_threads(4);
#pragma omp parallel shared(a,b,c,nthreads,chunk) private(tid,i,j,k)
  {
  tid = omp_get_thread_num();
  if (tid == 0)
    {
    nthreads = omp_get_num_threads();
    printf("Starting matrix multiple example with %d threads\n",nthreads);
    printf("Initializing matrices...\n");
    }
  /*** Initialize matrices ***/
  #pragma omp for schedule (static, chunk) 
  for (i=0; i<NRA; i++)
    for (j=0; j<NCA; j++)
      a[i][j]= i+j;
  #pragma omp for schedule (static, chunk)
  for (i=0; i<NCA; i++)
    for (j=0; j<NCB; j++)
      b[i][j]= i*j;
  #pragma omp for schedule (static, chunk)
  for (i=0; i<NRA; i++)
    for (j=0; j<NCB; j++)
      c[i][j]= 0;

  /*** Do matrix multiply sharing iterations on outer loop ***/
  /*** Display who does which iterations for demonstration purposes ***/
  printf("Thread %d starting matrix multiply...\n",tid);
  #pragma omp for schedule (static, chunk)
  for (i=0; i<NRA; i++)    
    {
    printf("Thread=%d did row=%d\n",tid,i);
    for(j=0; j<NCB; j++)       
      for (k=0; k<NCA; k++)
        c[i][j] += a[i][k] * b[k][j];
    }
  }   /*** End of parallel region ***/

/*** Print results ***/
printf("******************************************************\n");
printf("Result Matrix:\n");
for (i=0; i<NRA; i++)
  {
  for (j=0; j<NCB; j++) 
    printf("%6.2f   ", c[i][j]);
  printf("\n"); 
  }
printf("******************************************************\n");
printf ("Done.\n");
return 0;
}
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to