Hello! I'm following the tutorial of gem5 and my advisor of PhD give me a task to transform the script two_level.py <http://two_level.pyhttps://gem5.googlesource.com/public/gem5/+/refs/heads/stable/configs/learning_gem5/part1/two_level.py> that use the caches.py <https://gem5.googlesource.com/public/gem5/+/refs/heads/stable/configs/learning_gem5/part1/caches.py> to a multicore system that's run some multi thread program (to start with a simple hello that each thread prints a hello with some id). To compile the multithread program I use m5threads.
So I create two cpus and give them the same binary (I put in the example two things I try). I thought that I would get it but keep having problemas and I have no clue of what I'm missing. I got a lot of different problemas, here are two examples: - gem5.opt: build/X86/sim/mem_state.cc:177: void gem5::MemState::mapRegion(gem5::Addr, gem5::Addr, const string&, int, gem5::Addr): Assertion `isUnmapped(start_addr, length)' failed. - gem5.opt: build/X86/mem/noncoherent_xbar.cc:108: virtual bool gem5::NoncoherentXBar::recvTimingReq(gem5::PacketPtr, gem5::PortID): Assertion `!pkt->isExpressSnoop()' failed. - build/X86/mem/mem_ctrl.cc:411: panic: panic condition pkt->cacheResponding() occurred: Should not see packets where cache is responding (error using CoherentXBar) Here is what I have: import m5 from m5.objects import * from gem5.runtime import get_runtime_isa m5.util.addToPath("../../") from caches import * from common import SimpleOpts thispath = os.path.dirname(os.path.realpath(__file__)) default_binary = os.path.join( thispath, "../../../", "tests/test-progs/hello/bin/x86/linux/hello-multi", ) SimpleOpts.add_option("binary", nargs="?", default=default_binary) args = SimpleOpts.parse_args() num_cpus = 2 system = System() system.clk_domain = SrcClockDomain() system.clk_domain.clock = "1GHz" system.clk_domain.voltage_domain = VoltageDomain() system.mem_mode = "timing" # Use timing accesses system.mem_ranges = [AddrRange("512MB")] # Create an address range cpus = [] for i in range(num_cpus): cpu = X86TimingSimpleCPU(cpu_id=i) cpus.append(cpu) system.membus = CoherentXBar(forward_latency=10, frontend_latency=5, response_latency=100, width=64) system.l2bus = L2XBar() system.l2cache = L2Cache(args) system.l2cache.connectCPUSideBus(system.l2bus) system.l2cache.connectMemSideBus(system.membus) system.system_port = system.membus.cpu_side_ports system.mem_ctrl = MemCtrl() system.mem_ctrl.dram = DDR3_1600_8x8() system.mem_ctrl.dram.range = system.mem_ranges[0] system.mem_ctrl.port = system.membus.mem_side_ports system.workload = SEWorkload.init_compatible(args.binary) process = Process(cmd=args.binary) for cpu in cpus: cpu.clk_domain = system.clk_domain cpu.addPrivateSplitL1Caches( L1ICache(args), L1DCache(args) ) cpu.icache.connectBus(system.l2bus) cpu.dcache.connectBus(system.l2bus) cpu.createInterruptController() cpu.interrupts[0].pio = system.membus.mem_side_ports cpu.interrupts[0].int_requestor = system.membus.cpu_side_ports cpu.interrupts[0].int_responder = system.membus.mem_side_ports cpu.createThreads() # One of these two lines. The first one gives me the first error that mentioned # and the second one the second... cpu.workload = [process] * int(num_cpus) # first error cpu.workload = process # second error system.cpu = cpus root = Root(full_system=False, system=system) m5.instantiate() print("Beginning simulation!") exit_event = m5.simulate() print("Exiting @ tick %i because %s" % (m5.curTick(), exit_event.getCause())) and here is the simple program compiled like (works if I run it in the command line): - g++-4.8 -c -o *hello*.o *hello*.c - g++-4.8 -static -o *hello* hello.o path/m5threads/pthread.o #include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_THREADS 2 void* hello(void* arg){ int id = *((int*) arg); printf("hello %d\n", id); pthread_exit(NULL); } int main() { int i, rc; pthread_t threads[NUM_THREADS]; int thread_ids[NUM_THREADS]; for (i = 0; i < NUM_THREADS; i++) { thread_ids[i] = i; rc = pthread_create(&threads[i], NULL, hello, (void*) &thread_ids[i]); if (rc) { printf("Error: return code from pthread_create() is %d\n", rc); exit(-1); } } for (i = 0; i < NUM_THREADS; i++) { pthread_join(threads[i], NULL); } pthread_exit(NULL); }
_______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org