<div class="gmail_quote">On Sat, May 12, 2012 at 8:11 PM, Shri <span dir="ltr"><<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div class="im"><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div>
<div style="font-size:12pt;font-family:'Times New Roman'"><blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255);margin-left:5px;padding-left:5px"><div class="gmail_quote">
On Sat, May 12, 2012 at 6:40 AM, Shri<span> </span><span dir="ltr"><<a href="mailto:abhyshr@mcs.anl.gov" target="_blank">abhyshr@mcs.anl.gov</a>></span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:'Times New Roman'">1. I needed functions in sched.h like CPU_SET and others for setting the core affinities and these are only active if __USE_GNU is set and i wasn't sure whether _GNU_SOURCE or __USE_GNU should be defined directly, so i put in both.</div>
</div></blockquote><div><br></div><div>__USE_GNU should never be defined directly.</div><div><br></div><div><a href="http://gcc.gnu.org/ml/fortran/2005-10/msg00365.html" target="_blank">http://gcc.gnu.org/ml/fortran/2005-10/msg00365.html</a></div>
<div><a href="http://stackoverflow.com/questions/7296963/gnu-source-and-use-gnu" target="_blank">http://stackoverflow.com/questions/7296963/gnu-source-and-use-gnu</a></div><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:'Times New Roman'"><div><br></div><div><sched.h></div><div><div>#ifdef __USE_GNU</div><div>/* Access macros for `cpu_set'.  */</div><div>#define CPU_SETSIZE __CPU_SETSIZE</div>
<div>#define CPU_SET(cpu, cpusetp)   __CPU_SET (cpu, cpusetp)</div><div>#define CPU_CLR(cpu, cpusetp)   __CPU_CLR (cpu, cpusetp)</div><div>#define CPU_ISSET(cpu, cpusetp) __CPU_ISSET (cpu, cpusetp)</div><div>#define CPU_ZERO(cpusetp)       __CPU_ZERO (cpusetp)</div>
<div><br></div><div>With your changes i get the following build errors on Karlin.</div></div></div></div></blockquote><div><br></div><div>I'm pretty sure the correct fix is to get _GNU_SOURCE defined before anything system headers are included. Should probably write the test in Configure.py and put it in with PETSC_DESIRE_FEATURE_TEST_MACROS.</div>
</div></blockquote></div></div></span></blockquote><div><br></div></div>      Done, let me know if i can push it.</div></div></blockquote><div><br></div><div>Yes, please.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div><div class="h5"><br><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><div>
<div style="font-size:12pt;font-family:'Times New Roman'"><blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255);margin-left:5px;padding-left:5px"><div class="gmail_quote">
<div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
<div style="font-size:12pt;font-family:'Times New Roman'"><div><div><br></div><div><div>/home/abhyshr/petsc/petsc-dev/src/sys/threadcomm/impls/pthread/pthread.c:45:5: warning: implicit declaration of function ‘CPU_ZERO’ [-Wimplicit-function-declaration]</div>
<div>/home/abhyshr/petsc/petsc-dev/src/sys/threadcomm/impls/pthread/pthread.c:46:5: warning: implicit declaration of function ‘CPU_SET’ [-Wimplicit-function-declaration]</div><div>/home/abhyshr/petsc/petsc-dev/src/sys/threadcomm/impls/pthread/pthread.c:47:5: warning: implicit declaration of function ‘pthread_setaffinity_np’ [-Wimplicit-function-declaration]</div>
<div>/home/abhyshr/petsc/petsc-dev/src/sys/threadcomm/impls/pthread/pthread.c: In function ‘PetscThreadCommCreate_PThread’:</div><div>/home/abhyshr/petsc/petsc-dev/src/sys/threadcomm/impls/pthread/pthread.c:177:5: warning: implicit declaration of function ‘sched_setaffinity’ [-Wimplicit-function-declaration]</div>
<div>[ 29%] Building C object CMakeFiles/petsc.dir/src/vec/pf/interface/ftn-auto/pff.c.o</div><div>/home/abhyshr/petsc/petsc-dev/src/sys/objects/pthread/pthread.c: In function ‘PetscSetMainThreadAffinity’:</div><div>/home/abhyshr/petsc/petsc-dev/src/sys/objects/pthread/pthread.c:53:3: warning: implicit declaration of function ‘CPU_ZERO’ [-Wimplicit-function-declaration]</div>
<div>/home/abhyshr/petsc/petsc-dev/src/sys/objects/pthread/pthread.c:54:3: warning: implicit declaration of function ‘CPU_SET’ [-Wimplicit-function-declaration]</div><div>/home/abhyshr/petsc/petsc-dev/src/sys/objects/pthread/pthread.c:55:3: warning: implicit declaration of function ‘sched_setaffinity’ [-Wimplicit-function-declaration]</div>
<div>/home/abhyshr/petsc/petsc-dev/src/sys/objects/pthread/pthread.c: In function ‘PetscThreadsDoCoreAffinity’:</div><div>/home/abhyshr/petsc/petsc-dev/src/sys/objects/pthread/pthread.c:70:5: warning: implicit declaration of function ‘pthread_setaffinity_np’ [-Wimplicit-function-declaration]</div>
<div>[ 29%] Building C object CMakeFiles/petsc.dir/src/vec/is/impls/general/ftn-auto/generalf.c.o</div><br><hr><blockquote style="border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255);margin-left:5px;padding-left:5px">
<div>1$ cat a.c</div><div><div><div>#define _POSIX_C_SOURCE 200112L</div><div>#include <string.h></div><div>#define __USE_GNU</div><div>#include <time.h></div><div><br></div><div>$ gcc -c a.c</div><div>In file included from a.c:4:0:</div>
<div>/usr/include/time.h:226:5: error: unknown type name ‘__locale_t’</div><div><br></div><div><br></div><div>1. Shri, why is __USE_GNU being defined directly?</div><div><br></div><div>2. If we are defining _GNU_SOURCE, it _must_ be defined before any system headers are included, see PETSC_DESIRE_FEATURE_TEST_MACROS (petscsys.h and config/PETSc/Configure.py:configureFeatureTestMacros()).</div>
<div><br></div><div>3. I pushed <a href="http://petsc.cs.iit.edu/petsc/petsc-dev/rev/81ca8251e64d" target="_blank">http://petsc.cs.iit.edu/petsc/petsc-dev/rev/81ca8251e64d</a>, but we need a more complete solution (including #2).</div>
</div></div></blockquote></div></div></div></div></blockquote></div></blockquote></div></div></span></blockquote></div></div></div><br></div></blockquote></div><br>