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

Inconsistent output working with lscpu output #110

Closed
renkun-ken opened this issue Nov 15, 2021 · 3 comments
Closed

Inconsistent output working with lscpu output #110

renkun-ken opened this issue Nov 15, 2021 · 3 comments

Comments

@renkun-ken
Copy link

renkun-ken commented Nov 15, 2021

yaml::yaml.load does not properly work with the following input from lscpu:

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              112
On-line CPU(s) list: 0-111
Thread(s) per core:  2
Core(s) per socket:  28
Socket(s):           2
NUMA node(s):        2
Vendor ID:           GenuineIntel
CPU family:          6
Model:               85
Model name:          Intel(R) Xeon(R) Gold 6258R CPU @ 2.70GHz
Stepping:            7
CPU MHz:             3399.999
BogoMIPS:            5400.00
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            39424K
NUMA node0 CPU(s):   0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110
NUMA node1 CPU(s):   1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
In yaml::yaml.load(lscpu) :
  NAs introduced by coercion: 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111 is not an integer

The NUMA node0 CPU(s) is correctly produced while the NUMA node1 CPU(s) is NA as indicated by the warning.

@spgarbet
Copy link
Member

I can't find anywhere that lscpu claims to put out valid yml. I tried it on my laptop and got a different error and when I looked into it that line was not valid YAML 1.1. If it's supposed to be valid yaml 1.1, I will open a ticket with the lscpu maintainers. I think in your example the return characters are missing as well.

lscpu has an "-J" option that generates valid json. That might be a better option as that's explicitly supported.

@renkun-ken
Copy link
Author

Thanks for pointing to lscpu -J.

I'm just curious why the following input has different behavior:

> yaml::yaml.load("name: 0,2,4,6")
Warning in yaml::yaml.load("name: 0,2,4,6") :
  NAs introduced by coercion: 0,2,4,6 is not an integer
$name
[1] NA


> yaml::yaml.load("name: 0,2,4,6,8")
$name
[1] "0,2,4,6,8"


> yaml::yaml.load("name: 1,3,5,7")
Warning in yaml::yaml.load("name: 1,3,5,7") :
  NAs introduced by coercion: 1,3,5,7 is not an integer
$name
[1] NA

@spgarbet
Copy link
Member

I reduced it to this:

> yaml::yaml.load("name: 0,1")
$name
[1] NA

Warning message:
In yaml::yaml.load("name: 0,1") :
  NAs introduced by coercion: 0,1 is not an integer
> yaml::yaml.load("name: 0,8")
$name
[1] "0,8"

Then I tested the inverse:

> x <- yaml::yaml.load('name: "0,2"')
> as.yaml(x)
[1] "name: '0,2'\n"
> x <- yaml::yaml.load('name: "0,8"')
> as.yaml(x)
[1] "name: 0,8\n"

Note that both were imported with quotes, yet the 0,8 doesn't print with them. I suspect that there is an interaction between the "," and the octal parsing.

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

2 participants