HiExcuse me,i have a problem.At first i use chroot into mounted disk image then compile a sample attached code with g++. In sample code i have a command that return number of existing processor and mapping thread on existing cpu. I don't edit fs.py.I use this command in running gem5 but gem5 show me that there is one processor.I don't know why gem5 return one processor whereas I use --num-cpu=2???Thanks. command:./build/X86/gem5.fast configs/example/fs.py --kernel=/dist/m5/system1/binaries/x86_64-vmlinux-2.6.22.9.smp --disk-image=/dist/m5/system1/disks/linux-x86.img --script=salam.rCS --num-cpus=2 --caches --cpu-type=timing
my script.rCS
Description: Binary data
#include <stdio.h> #include <pthread.h> #include <unistd.h>
void* DoWork(void* args) { printf("ID: %lu, CPU: %d\n", pthread_self(), sched_getcpu()); return 0; } int main() { int numberOfProcessors = sysconf(_SC_NPROCESSORS_ONLN); printf("Number of processors: %d\n", numberOfProcessors); pthread_t threads[numberOfProcessors]; pthread_attr_t attr; cpu_set_t cpus; pthread_attr_init(&attr); for (int i = 0; i < numberOfProcessors; i++) { CPU_ZERO(&cpus); CPU_SET(i, &cpus); pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpus); pthread_create(&threads[i], &attr, DoWork, NULL); } printf("Number of processors: %d\n", numberOfProcessors); for (int i = 0; i < numberOfProcessors; i++) { pthread_join(threads[i], NULL); } return 0; }
_______________________________________________ gem5-users mailing list gem5-users@gem5.org http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users