This is EXACTLY the CRUX of the matter, with this precompile command, there is 
no more error! Thanks for your patience with my numerous and continuous 
questions.


Je vous remercie !! 
 
 
------------------ Original ------------------
From: &nbsp;"Barry&nbsp;Smith"<[email protected]&gt;;
Date: &nbsp;Wed, Jun 28, 2023 10:24 AM
To: &nbsp;"冯上玮"<[email protected]&gt;; 
Cc: &nbsp;"Matthew Knepley"<[email protected]&gt;; 
"petsc-users"<[email protected]&gt;; 
Subject: &nbsp;Re: [petsc-users] Problem in some macro when using VS+intel cl

&nbsp;



&nbsp; &nbsp;The macros expand differently depending on the compiler being 
used. In this case

#if defined(PETSC_HAVE_BUILTIN_EXPECT)
&nbsp; #define PetscUnlikely(cond) __builtin_expect(!!(cond), 0)
&nbsp; #define PetscLikely(cond) &nbsp; __builtin_expect(!!(cond), 1)
#else
&nbsp; #define PetscUnlikely(cond) (cond)
&nbsp; #define PetscLikely(cond) &nbsp; (cond)
#endif



So with Microsoft Windows compilers, if they do not support built_inexpect the 
compiler will only see the #else for the macro thus the compiler would never 
see the __builtin_expect


You can check in $PETSC_DIR/$PETSC_ARCH/include/petscconf.h and see if 
PETSC_HAVE_BUILTIN_EXPECT is defined. ./configure determines if this (and many 
other) features are supported by the compiler. It is conceivable that somehow 
configure determined incorrectly that this is supported.







On Jun 27, 2023, at 10:09 PM, 冯上玮 <[email protected]&gt; wrote:

I've followed your advice and include the header's file and libraries in Visual 
Studio. Such "error" still shows but I can build the project! It's strange!
I expand the CHKERRQ macro and find the error actually locates at


<[email protected]&gt;
&nbsp;
What I know from google is that the "__builtin_expect__" is defined in GCC, so 
is it unsolvable in Windows with visual studio C compiler or Inter C compiler?
------------------ Original ------------------
From: &nbsp;"Matthew Knepley"<[email protected]&gt;;
Date: &nbsp;Wed, Jun 28, 2023 01:59 AM
To: &nbsp;"冯上玮"<[email protected]&gt;; 
Cc: &nbsp;"petsc-users"<[email protected]&gt;; 
Subject: &nbsp;Re: [petsc-users] Problem in some macro when using VS+intel cl

&nbsp;

On Tue, Jun 27, 2023 at 11:32 AM 冯上玮 <[email protected]&gt; wrote:

Hi, 


After failure with MS-MPI once and once again, I tried icl+oneAPI and succeeded 
in installing and testing PESTc in Cygwin!


However, (always however) when I copied the example code on Getting Started 
page on visual studio, there are tons of error like:
<[email protected]&gt;
I just wonder where the problem locates, I've googled this error message and it 
seems that it's induced by the difference of compilers, c.f. 
https://stackoverflow.com/questions/42136395/identifier-builtin-expect-is-undefined-during-ros-on-win-tutorial-talker-ex.
 But Intel says that they also provide such thing on icl, and I actually use 
this compiler instead of visual studio cl... 




The IDE is not showing the actual error message. Are you sure that your IDE 
build has the right includes and libraries? You can
get these using


&nbsp; cd $PETSC_DIR
&nbsp; make getincludedirs
&nbsp; make getlinklibs


&nbsp; Thanks,


&nbsp; &nbsp; &nbsp;Matt
&nbsp;
Anyway, the project could be built if I delete these error-checking macro.


Installing feedback (or as a test result):
When configure on windows, only icl + impi works, and in this case, both 
--with-cc and --with-cxx options need to point out the version like: 
--with-cc-std-c99 and --with-cxx-std-c++'ver'. Other combinations such as cl + 
impi, icl + msmpi, cl + msmpi never work. My tutor told me that older version 
of msmpi may work but I never try this.


FENG.







-- 
What most experimenters take for granted before they begin their experiments is 
infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener


https://www.cse.buffalo.edu/~knepley/

Reply via email to