{"id":1253,"date":"2024-02-01T23:46:56","date_gmt":"2024-02-01T23:46:56","guid":{"rendered":"https:\/\/mvermeulen.org\/perf\/?page_id=1253"},"modified":"2024-02-02T03:08:53","modified_gmt":"2024-02-02T03:08:53","slug":"n-queens","status":"publish","type":"page","link":"https:\/\/mvermeulen.org\/perf\/workloads\/phoronix\/n-queens\/","title":{"rendered":"n-queens"},"content":{"rendered":"\n<p>An OpenMP implementation of the n-queens problem.  This is also the description of &#8220;m-queens&#8221; so we can see how they compare. This runs 4x as quick, though the board sizes may be different. This shows processes on each core.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"960\" src=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/systemtime-7.png\" alt=\"\" class=\"wp-image-1274\" srcset=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/systemtime-7.png 1280w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/systemtime-7-1024x768.png 1024w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/systemtime-7-768x576.png 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n\n\n<p>Topdown profile shows a surprisingly high branch mispredict rate. Otherwise frontend stalls and retirement rate are similar.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"960\" src=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/amdtopdown-7.png\" alt=\"\" class=\"wp-image-1276\" srcset=\"https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/amdtopdown-7.png 1280w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/amdtopdown-7-1024x768.png 1024w, https:\/\/mvermeulen.org\/perf\/wp-content\/uploads\/sites\/7\/2024\/02\/amdtopdown-7-768x576.png 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n\n\n<p>AMD metrics show many floating point instructions and very little L2 access.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>elapsed              59.706\non_cpu               0.734          # 11.75 \/ 16 cores\nutime                700.580\nstime                0.941\nnvcsw                1969           # 20.79%\nnivcsw               7502           # 79.21%\ninblock              0              # 0.00\/sec\nonblock              12560          # 210.36\/sec\ncpu-clock            701577930989   # 701.578 seconds\ntask-clock           701582852603   # 701.583 seconds\npage faults          147260         # 209.897\/sec\ncontext switches     9598           # 13.680\/sec\ncpu migrations       266            # 0.379\/sec\nmajor page faults    2              # 0.003\/sec\nminor page faults    147258         # 209.894\/sec\nalignment faults     0              # 0.000\/sec\nemulation faults     0              # 0.000\/sec\nbranches             358274822489   # 105.547 branches per 1000 inst\nbranch misses        53094091069    # 14.82% branch miss\nconditional          268491549572   # 79.097 conditional branches per 1000 inst\nindirect             47097724       # 0.014 indirect branches per 1000 inst\ncpu-cycles           2910026096341  # 3.02 GHz\ninstructions         3393651570228  # 1.17 IPC\nslots                5826052535754  #\nretiring             1150107894282  # 19.7% (30.4%)\n-- ucode             16366252       #     0.0%\n-- fastpath          1150091528030  #    19.7%\nfrontend             1205152582022  # 20.7% (31.8%)\n-- latency           1044472772652  #    17.9%\n-- bandwidth         160679809370   #     2.8%\nbackend              855912736625   # 14.7% (22.6%)\n-- cpu               295050537557   #     5.1%\n-- memory            560862199068   #     9.6%\nspeculation          577782310149   #  9.9% (15.2%) high\n-- branch mispredict 577772539962   #     9.9%\n-- pipeline restart  9770187        #     0.0%\nsmt-contention       2037084896785  # 35.0% ( 0.0%)\ncpu-cycles           2907871863146  # 3.04 GHz\ninstructions         3390883633345  # 1.17 IPC\ninstructions         1133281902047  # 0.121 l2 access per 1000 inst\nl2 hit from l1       119341967      # 14.89% l2 miss\nl2 miss from l1      11697818       #\nl2 hit from l2 pf    8853005        #\nl3 hit from l2 pf    4524968        #\nl3 miss from l2 pf   4161961        #\ninstructions         1130949836740  # 209.890 float per 1000 inst\nfloat 512            67             # 0.000 AVX-512 per 1000 inst\nfloat 256            656            # 0.000 AVX-256 per 1000 inst\nfloat 128            237375367252   # 209.890 AVX-128 per 1000 inst\nfloat MMX            0              # 0.000 MMX per 1000 inst\nfloat scalar         0              # 0.000 scalar per 1000 inst\n<\/code><\/pre>\n\n\n\n<p>Intel metrics<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>elapsed              205.379\non_cpu               0.810          # 12.96 \/ 16 cores\nutime                2660.432\nstime                0.462\nnvcsw                1992           # 8.22%\nnivcsw               22250          # 91.78%\ninblock              8              # 0.04\/sec\nonblock              1456           # 7.09\/sec\ncpu-clock            2661041175202  # 2661.041 seconds\ntask-clock           2661049045772  # 2661.049 seconds\npage faults          140831         # 52.923\/sec\ncontext switches     25082          # 9.426\/sec\ncpu migrations       258            # 0.097\/sec\nmajor page faults    0              # 0.000\/sec\nminor page faults    140831         # 52.923\/sec\nalignment faults     0              # 0.000\/sec\nemulation faults     0              # 0.000\/sec\nbranches             803581484498   # 81.202 branches per 1000 inst\nbranch misses        164085751671   # 20.42% branch miss\nconditional          803581501170   # 81.202 conditional branches per 1000 inst\nindirect             209212950465   # 21.141 indirect branches per 1000 inst\nslots                4783298033636  #\nretiring             1671294828132  # 34.9% (34.9%)\n-- ucode             94088025026    #     2.0%\n-- fastpath          1577206803106  #    33.0%\nfrontend             560253074951   # 11.7% (11.7%)\n-- latency           413909373463   #     8.7%\n-- bandwidth         146343701488   #     3.1%\nbackend              344172623109   #  7.2% ( 7.2%) low\n-- cpu               290550559133   #     6.1%\n-- memory            53622063976    #     1.1%\nspeculation          2234265584235  # 46.7% (46.7%) high\n-- branch mispredict 2234120655291  #    46.7%\n-- pipeline restart  144928944      #     0.0%\nsmt-contention       0              #  0.0% ( 0.0%)\ncpu-cycles           1725231955347  # 1.53 GHz\ninstructions         1873420941187  # 1.09 IPC\nl2 access            271608413      # 0.157 l2 access per 1000 inst\nl2 miss              82913103       # 30.53% l2 miss\n<\/code><\/pre>\n\n\n\n<p>Process overview<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>399 processes\n\t 48 qn24b_openmp         11241.12     0.16\n\t 68 clinfo                  16.52     5.99\n\t 38 vulkaninfo               1.13     1.15\n\t  4 vulkani:disk$0           0.12     0.12\n\t  6 glxinfo:gdrv0            0.08     0.09\n\t  6 glxinfo:gl0              0.08     0.09\n\t  6 php                      0.06     0.07\n\t  2 llvmpipe-0               0.06     0.06\n\t  2 llvmpipe-1               0.06     0.06\n\t  2 llvmpipe-10              0.06     0.06\n\t  2 llvmpipe-11              0.06     0.06\n\t  2 llvmpipe-12              0.06     0.06\n\t  2 llvmpipe-13              0.06     0.06\n\t  2 llvmpipe-14              0.06     0.06\n\t  2 llvmpipe-15              0.06     0.06\n\t  2 llvmpipe-2               0.06     0.06\n\t  2 llvmpipe-3               0.06     0.06\n\t  2 llvmpipe-4               0.06     0.06\n\t  2 llvmpipe-5               0.06     0.06\n\t  2 llvmpipe-6               0.06     0.06\n\t  2 llvmpipe-7               0.06     0.06\n\t  2 llvmpipe-8               0.06     0.06\n\t  2 llvmpipe-9               0.06     0.06\n\t  2 glxinfo                  0.05     0.04\n\t  6 clang                    0.04     0.08\n\t  2 glxinfo:cs0              0.04     0.03\n\t  2 glxinfo:disk$0           0.04     0.03\n\t  2 glxinfo:sh0              0.04     0.03\n\t  2 glxinfo:shlo0            0.04     0.03\n\t  3 rocminfo                 0.03     0.00\n\t  1 lspci                    0.00     0.03\n\t  1 ps                       0.00     0.01\n\t 82 sh                       0.00     0.00\n\t 13 gcc                      0.00     0.00\n\t 11 gsettings                0.00     0.00\n\t  8 stat                     0.00     0.00\n\t  8 systemd-detect-          0.00     0.00\n\t  6 llvm-link                0.00     0.00\n\t  5 phoronix-test-s          0.00     0.00\n\t  4 gmain                    0.00     0.00\n\t  3 n-queens                 0.00     0.00\n\t  2 cc                       0.00     0.00\n\t  2 lscpu                    0.00     0.00\n\t  2 uname                    0.00     0.00\n\t  2 which                    0.00     0.00\n\t  2 xset                     0.00     0.00\n\t  1 date                     0.00     0.00\n\t  1 dconf worker             0.00     0.00\n\t  1 dirname                  0.00     0.00\n\t  1 dmesg                    0.00     0.00\n\t  1 dmidecode                0.00     0.00\n\t  1 grep                     0.00     0.00\n\t  1 ifconfig                 0.00     0.00\n\t  1 ip                       0.00     0.00\n\t  1 lsmod                    0.00     0.00\n\t  1 mktemp                   0.00     0.00\n\t  1 qdbus                    0.00     0.00\n\t  1 readlink                 0.00     0.00\n\t  1 realpath                 0.00     0.00\n\t  1 sed                      0.00     0.00\n\t  1 sort                     0.00     0.00\n\t  1 stty                     0.00     0.00\n\t  1 systemctl                0.00     0.00\n\t  1 template.sh              0.00     0.00\n\t  1 wc                       0.00     0.00\n\t  1 xrandr                   0.00     0.00\n0 processes running\n47 maximum processes\n<\/code><\/pre>\n\n\n\n<p>Computation blocks<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>      112879) n-queens         cpu=4 start=5.65  finish=20.31\n        112880) qn24b_openmp     cpu=12 start=5.65  finish=20.31\n          112881) qn24b_openmp     cpu=8 start=5.65  finish=20.31\n          112882) qn24b_openmp     cpu=15 start=5.65  finish=20.31\n          112883) qn24b_openmp     cpu=10 start=5.65  finish=20.31\n          112884) qn24b_openmp     cpu=1 start=5.65  finish=20.31\n          112885) qn24b_openmp     cpu=3 start=5.65  finish=20.31\n          112886) qn24b_openmp     cpu=5 start=5.65  finish=20.31\n          112887) qn24b_openmp     cpu=4 start=5.66  finish=20.31\n          112888) qn24b_openmp     cpu=6 start=5.66  finish=20.31\n          112889) qn24b_openmp     cpu=13 start=5.66  finish=20.31\n          112890) qn24b_openmp     cpu=0 start=5.66  finish=20.31\n          112891) qn24b_openmp     cpu=2 start=5.66  finish=20.31\n          112892) qn24b_openmp     cpu=9 start=5.66  finish=20.31\n          112893) qn24b_openmp     cpu=7 start=5.66  finish=20.31\n          112894) qn24b_openmp     cpu=11 start=5.66  finish=20.31\n          112895) qn24b_openmp     cpu=14 start=5.66  finish=20.31\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>An OpenMP implementation of the n-queens problem. This is also the description of &#8220;m-queens&#8221; so we can see how they compare. This runs 4x as quick, though the board sizes may be different. This shows processes on each core. Topdown <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/mvermeulen.org\/perf\/workloads\/phoronix\/n-queens\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":58,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1253","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/1253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/comments?post=1253"}],"version-history":[{"count":3,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/1253\/revisions"}],"predecessor-version":[{"id":1277,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/1253\/revisions\/1277"}],"up":[{"embeddable":true,"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/pages\/58"}],"wp:attachment":[{"href":"https:\/\/mvermeulen.org\/perf\/wp-json\/wp\/v2\/media?parent=1253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}