This should work.

Attached is a diff for the simple.py script in configs/learning_gem5/part1/
that has 4 CPUs and runs hello 4 times. Hopefully this helps.

For a multithreaded application, I believe you'll use a similar config
script (instantiate multiple processes all with the same binary file path).
Then, the binaries should be linked to m5threads instead of pthreads.

Jason

On Mon, Oct 10, 2016 at 8:16 AM anoir nechi <anoirne...@gmail.com> wrote:

>
>
> *Hi *
>
> *I wrote a configuration script for a multicore system based on ARM and it
> seems fine except for the workload. i wanted to try testing the
> configuration by assigning a hello world executable for each CPU.*
> *I tried creating different processes but I've got some indexing error
> then i made a for loop like this:*
> i=0
> for i in xrange(np):
>     process = LiveProcess()
>     process.cmd = ['tests/test-progs/hello/bin/arm/linux/hello']
>     system.cpu[i].workload = process
>     system.cpu[i].createThreads()
> *and all i get is this :*
> Global frequency set at 1000000000000 ticks per second
> warn: DRAM device capacity (4096 Mbytes) does not match the address range
> assigned (512 Mbytes)
> 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
> 0: system.remote_gdb.listener: listening for remote gdb #1 on port 7001
> 0: system.remote_gdb.listener: listening for remote gdb #2 on port 7002
> 0: system.remote_gdb.listener: listening for remote gdb #3 on port 7003
>
> *it suppose to show 4 x Hello World!. i don't understand the problem!!*
>
> *One other thing, i know that to use a multithreaded application  I have
> to use the m5threads, But, do I have to apply some changes to my
> configuration script to support the multithreaded applications ?*
>
> *Thank you*
>
> *PS : Attached the configuration script*
> --
> *Anouar NECHI*
>
>
> *IT Engineer : Industrial systemsHigher Institute of Computer Science*
>
>
> _______________________________________________
>
> gem5-users mailing list
>
> gem5-users@gem5.org
>
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
# HG changeset patch
# Parent 0e86d5172ab2385af45ee3c7a5371330e9a7492d
diff -r 0e86d5172ab2 -r f1c8bb757af5 configs/learning_gem5/part1/simple.py
--- a/configs/learning_gem5/part1/simple.py	Tue Oct 11 09:23:41 2016 -0500
+++ b/configs/learning_gem5/part1/simple.py	Wed Oct 12 09:38:28 2016 -0500
@@ -54,25 +54,31 @@
 system.mem_mode = 'timing'               # Use timing accesses
 system.mem_ranges = [AddrRange('512MB')] # Create an address range
 
+cpus = 4
 # Create a simple CPU
-system.cpu = TimingSimpleCPU()
+cpu = []
+for i in range(cpus):
+    cpu.append(TimingSimpleCPU())
+system.cpu = cpu
 
 # Create a memory bus, a system crossbar, in this case
 system.membus = SystemXBar()
 
 # Hook the CPU ports up to the membus
-system.cpu.icache_port = system.membus.slave
-system.cpu.dcache_port = system.membus.slave
+for i in range(cpus):
+    system.cpu[i].icache_port = system.membus.slave
+    system.cpu[i].dcache_port = system.membus.slave
 
 # create the interrupt controller for the CPU and connect to the membus
-system.cpu.createInterruptController()
+for i in range(cpus):
+    system.cpu[i].createInterruptController()
 
-# For x86 only, make sure the interrupts are connected to the memory
-# Note: these are directly connected to the memory bus and are not cached
-if m5.defines.buildEnv['TARGET_ISA'] == "x86":
-    system.cpu.interrupts[0].pio = system.membus.master
-    system.cpu.interrupts[0].int_master = system.membus.slave
-    system.cpu.interrupts[0].int_slave = system.membus.master
+    # For x86 only, make sure the interrupts are connected to the memory
+    # Note: these are directly connected to the memory bus and are not cached
+    if m5.defines.buildEnv['TARGET_ISA'] == "x86":
+        system.cpu[i].interrupts[0].pio = system.membus.master
+        system.cpu[i].interrupts[0].int_master = system.membus.slave
+        system.cpu[i].interrupts[0].int_slave = system.membus.master
 
 # Create a DDR3 memory controller and connect it to the membus
 system.mem_ctrl = DDR3_1600_x64()
@@ -88,14 +94,15 @@
 # Run 'hello' and use the compiled ISA to find the binary
 binary = 'tests/test-progs/hello/bin/' + isa + '/linux/hello'
 
-# Create a process for a simple "Hello World" application
-process = LiveProcess()
-# Set the command
-# cmd is a list which begins with the executable (like argv)
-process.cmd = [binary]
-# Set the cpu to use the process as its workload and create thread contexts
-system.cpu.workload = process
-system.cpu.createThreads()
+for i in range(cpus):
+    # Create a process for a simple "Hello World" application
+    process = LiveProcess()
+    # Set the command
+    # cmd is a list which begins with the executable (like argv)
+    process.cmd = [binary]
+    # Set the cpu to use the process as its workload and create thread contexts
+    system.cpu[i].workload = process
+    system.cpu[i].createThreads()
 
 # set up the root SimObject and start the simulation
 root = Root(full_system = False, system = system)
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to