<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
The CPU supports avx2, but the compiler or the OS may not. You can print out the macros that the compiler defines and grep for avx2. The commands can be found at
<div> <a href="https://stackoverflow.com/questions/9349754/generate-list-of-preprocessor-macros-defined-by-the-compiler">https://stackoverflow.com/questions/9349754/generate-list-of-preprocessor-macros-defined-by-the-compiler</a></div>
<div><br>
</div>
<div>Hong<br>
<div dir="ltr"><br>
<blockquote type="cite">On Feb 13, 2021, at 8:48 PM, Barry Smith <bsmith@petsc.dev> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="">PETSc source has code like <span style="font-family: Menlo; font-size: 14px; font-variant-ligatures: no-common-ligatures; color: rgb(105, 103, 149);" class="">defined</span><span style="font-family: Menlo; font-size: 14px; font-variant-ligatures: no-common-ligatures;" class="">(__AVX2__)
in the source </span>but it does not seem to be able to find any of these macros (icc or gcc) on the petsc-02 system</div>
<div class=""><br class="">
</div>
<div class="">Are these macros supposed to be defined? How does on get them to be defined? Why are they not define? What am I doing wrong?</div>
<div class=""><br class="">
</div>
<div class="">Keep reading</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">$ lscpu </span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Architecture: x86_64</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">CPU op-mode(s): 32-bit, 64-bit</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Byte Order: Little Endian</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">CPU(s): 64</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">On-line CPU(s) list: 0-63</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Thread(s) per core: 2</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Core(s) per socket: 16</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Socket(s): 2</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">NUMA node(s): 2</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Vendor ID: GenuineIntel</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">CPU family: 6</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Model: 85</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Model name: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Stepping: 7</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">CPU MHz: 1000.603</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">CPU max MHz: 2301.0000</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">CPU min MHz: 1000.0000</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">BogoMIPS: 4600.00</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Virtualization: VT-x</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">L1d cache: 32K</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">L1i cache: 32K</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">L2 cache: 1024K</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">L3 cache: 22528K</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">NUMA node0 CPU(s): 0-15,32-47</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">NUMA node1 CPU(s): 16-31,48-63</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">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</span></div>
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">Test program </span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">#if</span><span style="font-variant-ligatures: no-common-ligatures" class="">
</span><span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">defined</span><span style="font-variant-ligatures: no-common-ligatures" class="">(__FMA__)</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(105, 103, 149);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">#error</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">
</span><span style="font-variant-ligatures: no-common-ligatures; color: #9d206f" class="">FMA</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(105, 103, 149);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">#endif</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 16px;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">#if</span><span style="font-variant-ligatures: no-common-ligatures" class="">
</span><span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">defined</span><span style="font-variant-ligatures: no-common-ligatures" class="">(__AVX512F__)</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(157, 32, 111);" class="">
<span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">#error</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">
</span><span style="font-variant-ligatures: no-common-ligatures" class="">AVX512F</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(105, 103, 149);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">#endif</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 16px;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">#if</span><span style="font-variant-ligatures: no-common-ligatures" class="">
</span><span style="font-variant-ligatures: no-common-ligatures; color: #696795" class="">defined</span><span style="font-variant-ligatures: no-common-ligatures" class="">(__AVX2__)</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(105, 103, 149);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">#error</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">
</span><span style="font-variant-ligatures: no-common-ligatures; color: #9d206f" class="">AVX2</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(105, 103, 149);" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">#endif</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 16px;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 16px;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 16px;" class="">
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">icc mytest.c</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(.text+0x20): undefined reference to `main'</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
</div>
</span></div>
</div>
</blockquote>
</div>
</body>
</html>