<div dir="ltr"><font face="courier new, monospace">An update on this issue for future searches:</font><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"><div>I am able to reproduce this bug outside cygwin and outside</div>
<div>petsc make/build system for a single petsc file</div><div>(sbaijfact2.c) after configuring petsc in the usual manner.</div><div><br></div><div>Note: scalar = complex<double>.</div><div><br></div><div>It is a bug in cl.exe in two versions I tested: VS 2012 x64 on</div>
<div>windows 7 x64 without VS updates (compiler version 17.00.50727.1)</div><div>and with latest update number 3  (compiler version 17.00.60610.1).</div></font><font face="courier new, monospace"><div><br></div><div>The error is not deterministic even if cl.exe is restricted</div>
<div>to run on 1 out of 4 cores for compiling a single file.</div><div>Otherwise cl.exe uses 4 threads and still dies due to</div><div>similar internal errors.  (I thought perhaps the single-threaded</div><div>invocation will fix this, but no...) The petsc source line</div>
<div>numbers reported in the crash are also not same in</div><div>different single-threaded cl.exe runs.</div><div><br></div><div>The error happened in roughly 10% of 100 consecutive</div><div>compilations of the file.  Happens with -O1 and -O2.</div>
<div>But no error when optimization is off.  Although I</div><div>have not gone so far as having a minimal workaround, two</div><div>possible solutions are to have optimization off for select</div><div>functions in a few files using #pragma or just turn off</div>
<div>optimizations for three directories where such errors</div><div>happened -</div><div><br></div><div><div>src/mat/impls/sbaij/seq/sbstream</div><div>src/mat/impls/sbaij/seq</div><div>src/mat/impls/baij/seq</div></div>
</font><font face="courier new, monospace"><div><br></div>Chetan<br><br>On Thu, Sep 5, 2013 at 8:53 PM, Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> wrote:<br>><br>> On Thu, 5 Sep 2013, Chetan Jhurani wrote:<br>
><br>> > Thanks.  I will try it.  An additional question - how does one turn off<br>> > optimization for a specific directory?  If I give an argument to<br>> > "CFLAGS =" in, say mat/impls/baij/seq/makefile, will it append<br>
> > or override?<br>><br>> Flags sepcified with CFLAGS will get appended to the current compile<br>> command.<br>><br>> If you need to replace some stuff in the target - you should look at<br>> PETSC_ARCH/conf/petscvariables - and check which variable you would<br>
> like to reset.<br>><br>> In this case - you might want to replace values of CC_FLAGS<br>><br>> Satish<br>><br>> >  I just want to play with optimization flags.  This will<br>> > not turn off optimization for a specific file but will be good to know.<br>
> ><br>> > Also, one more observation is that when I turned on procmon (somewhat<br>> > similar to strace) when compiling the full tree, then the failure<br>> > happened in a different file.  So not quite consistent as I had mentioned<br>
> > earlier.<br>> ><br>> > Procmon slows down the system and can also lead to differences in clock or<br>> > execution speed.  I can't be very sure about this but if the optimizer part<br>> > of compilation is time-sensitive (don't optimize for a very long<br>
> > time, or choose optimization based on some previous time measurements), then<br>> > a bug might not be encountered always.  Just a wild guess, especially since<br>> > these directories typically take longer to compile because of many manually<br>
> > unrolled loops in there.<br>> ><br>> > Chetan<br>> ><br>> > > -----Original Message-----<br>> > > From: Barry Smith [mailto:<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>]<br>
> > > Sent: Thursday, September 05, 2013 6:53 PM<br>> > > To: Chetan Jhurani<br>> > > Cc: 'petsc-dev'<br>> > > Subject: Re: [petsc-dev] different compiler behavior in make libfast and make all<br>
> > ><br>> > ><br>> > >   cygwin is a temperamental beast. I don't think the compiler is to blame but rather cygwin mis-<br>> > > providing something when many files are being dealt with quickly.<br>
> > ><br>> > >    make all simply calls make ACTION=libfast tree<br>> > ><br>> > >    When make all fails you can go down to the place it crashes and run make ACTION=libfast tree and it<br>
> > > will finish compiles in all the directories under that current directory. So you can get everything<br>> > > compiled with hopefully not too many manual makes needed.  I know this is not particularly<br>
> > > satisfactory by we still dream about a knight coming along in shining armor with lots of Windows<br>> > > experience figuring out a clean and simple way to avoid cygwin completely in the build process.<br>
> > ><br>> > >    Barry<br>> > ><br>> > ><br>> > > On Sep 5, 2013, at 6:16 PM, Chetan Jhurani <<a href="mailto:chetan.jhurani@gmail.com">chetan.jhurani@gmail.com</a>> wrote:<br>
> > ><br>> > > > I'm looking for suggestions on how to understand different compiler<br>> > > > behavior in make "libfast" in a sub-directory and make "all" in<br>> > > > top-level petsc directory.<br>
> > > ><br>> > > > The reason is that make all leads to an internal compiler error, seen<br>> > > > in make.log.  But doing make libfast for the same arch in the corresponding<br>> > > > subdirectory works fine.  So it is hard to work around the internal<br>
> > > > compiler error via some simplification.  This is with cygwin and visual<br>> > > > studio 2012.  The same petsc code compiles fine with an older visual studio.<br>> > > ><br>> > > > Here is an example of the error from make.log, which<br>
> > > > consistently happens here for a particular arch.<br>> > > ><br>> > > > petsc34\src\mat\impls\sbaij\seq\sbaij2.c(854) : fatal error C1001: An internal error has occurred in<br>> > > the compiler.<br>
> > > > (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 211)<br>> > > > To work around this problem, try simplifying or changing the program near the locations listed<br>> > > above.<br>
> > > > Please choose the Technical Support command on the Visual C++<br>> > > > Help menu, or open the Technical Support help file for more information<br>> > > > INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe'<br>
> > > ><br>> > > > The error happens in a different location (again consistently)<br>> > > > for a different arch.<br>> > > ><br>> > > > petsc34\src\mat\impls\sbaij\seq\sbstream\sbstrmfact.c(434)<br>
> > > ><br>> > > > Both errors don't get reproduced if I do a make libfast in these<br>> > > > directories.  I also invoked the compiler via cl and win32fe<br>> > > > and both these ways also work fine and generate object files of<br>
> > > > non-zero sizes.<br>> > > ><br>> > > > Thanks,<br>> > > ><br>> > > > Chetan<br>> > > ><br>> > > ><br>> ><br>> ><br>></font><br>
</div></div>