Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU Count #8

Open
tylerharter opened this issue Nov 17, 2017 · 10 comments
Open

CPU Count #8

tylerharter opened this issue Nov 17, 2017 · 10 comments

Comments

@tylerharter
Copy link

When I walk through the tutorial, the example seems to assume I have more cores than I actually do, leading to the following exception:

======================================================================
ERROR: test_run (tests.test_demo.Test_TraceAndSimulateLinuxDD)

Traceback (most recent call last):
File "tests/test_demo.py", line 28, in test_run
obj.main()
File "config_helper/experiment.py", line 235, in main
self.run()
File "config_helper/experiment.py", line 226, in run
run_workflow(self.conf)
File "workflow.py", line 14, in run_workflow
wf.run()
File "workflow.py", line 23, in run
event_iter = self._run_workload()
File "workflow.py", line 43, in _run_workload
event_iter = runner.run()
File "workrunner/wlrunner.py", line 168, in run
return self.run_with_blktrace()
File "workrunner/wlrunner.py", line 202, in run_with_blktrace
cpuhandler.set_cpus(self.conf['n_online_cpus'])
File "workrunner/cpuhandler.py", line 69, in set_cpus
enable_all_cpus()
File "workrunner/cpuhandler.py", line 62, in enable_all_cpus
enable_n_cpus(len(possible_cpus))
File "workrunner/cpuhandler.py", line 93, in enable_n_cpus
switch_cpu(cpuid, 'ON')
File "workrunner/cpuhandler.py", line 53, in switch_cpu
f = open(path, 'w')
IOError: [Errno 2] No such file or directory: '/sys/devices/system/cpu/cpu8/online'

@tylerharter
Copy link
Author

I only have 8 cores, so /sys/devices/system/cpu/cpu7/online exists, but /sys/devices/system/cpu/cpu8/online does not.

@junhe
Copy link
Owner

junhe commented Nov 21, 2017

Weird, I thought I automatically detected number of core... Will check it later.

@luminus7
Copy link

same problem here
Environment: 14.04 Ubuntu, 4.5.4 kernel
cpu: i5-8500 with 6cores

IOError: [Errno 2] No such file or directory: '/sys/devices/system/cpu/cpu6/online'
occured in every last line of error

attached file is log after $make test_all
wiscsim error 'cpu'.txt

@junhe
Copy link
Owner

junhe commented Feb 18, 2020

How many cores do you have? Could you do
$ ls /sys/devices/system/cpu/

@luminus7
Copy link

got 6 cores in my pc

~$ ls /sys/devices/system/cpu/
cpu0 cpu2 cpu4 cpufreq isolated microcode offline possible present
cpu1 cpu3 cpu5 cpuidle kernel_max modalias online power uevent

@junhe
Copy link
Owner

junhe commented Feb 18, 2020

Also, do the following?

$ cat /sys/devices/system/cpu/online

@luminus7
Copy link

sure!
~$ cat /sys/devices/system/cpu/online
0-5

@junhe
Copy link
Owner

junhe commented Feb 18, 2020 via email

@luminus7
Copy link

~$ cat /sys/devices/system/cpu/possible
0-7

in wiscsee/workrunner/cpuhandler.py

def get_possible_cpus():
    f = open("/sys/devices/system/cpu/possible", 'r')
    line = f.readline()
    f.close()

    # assuming format of 0-2,4,6-63
    items = line.split(',')
    cpus = []
    for item in items:
        if '-' in item:
            a,b = item.split('-')
            a = int(a)
            b = int(b)
            cpus.extend(range(a, b+1))
        else:
            cpus.append(int(item))

#    return cpus
    return range(0,6)

this make successful test_all, and run_demo

thank you for your fast and kind respond :)

@junhe
Copy link
Owner

junhe commented Feb 19, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants