Open JAWilliams123 opened 2 years ago
@fpguillet, do you have any insight on this issue. I remember that you tested VS 2019
, didn't you ?
I compiled only 3.4.0 using Visual Studio. Although it had also to do with "traits" and a Visual Studio include file incompatible with TFEL, the error is not the same (or at least it does not look like the same one).
@fpguillet Visual Studio 19
, isn't it ? I did compile 3.4.0 with Visual Studio 17
Yes, 2019.
cmake.exe .. -G "Visual Studio 15 2017" -Wno-dev -DCMAKE_BUILD_TYPE=Release -Dlocal-castem-header=OFF -Denable-fortran=ON -Denable-abaqus=ON
Currently, I have the same failure for Visual Studio 2017 - 2019 versions on tag 4.0.
Using Visual Studio 2017 builds as expected. No errors occured with Win32 Release. Using Visual Studio 2019 fails to build mtest files. However, mfront works as expected.
OS: Windows 10 build 21H1 CPU architecture: x86_64 Visual Studio 2017 - 2019 Intel oneAPI 2022.1
@baristelmen Thanks for the feed-back. I definitively have to fix Visual Studio 2019 support. What do you mean by "Visual Studio 2019 fails to build mtest files" ?
Apparently, VS2019 successfully builds several binaries including mfront mfm etc. However, errors occurred while building mtest binaries. Due to that, mtest binaries are not presented. Thus, I can actually use mfront to generate behaviors for abaqus (currently, I am only using abaqus interface but didn't run a case so far on windows) but can't use mtest to realize unit test.
On the Linux side with Ubuntu 20.04, Arch Linux or Fedora there are no problems with 4.0 version. We'll, at least on my tests, it was generating the interface and working fine with abaqus.
@baristelmen Thanks for the feed-backs ! Just to be sure, you didn't try icpc
on windows
, did you ?
To my knowledge, icpc
works fine on LiNuX
.
On Linux it's working just fine. For windows, I just quickly checked, oneAPI (HPC kit) sets environment automatically to be used with VS2017 (or 2019) and the default compiler is icx. Thank you for the info.
Just to be sure, I will try to use both to see the difference and report on this thread.
EDIT: Typo mistake. icc -> icx
Just to be sure, I will try to use both to see the difference and report on this thread.
@baristelmen Please do, I am fairly interested. However, as @fpguillet reported, I need to fix a few things on the Abaqus interface on windows
(see https://github.com/thelfer/tfel/discussions/47).
@thelfer there is a typo mistake on the previous comment. I'm sorry for that and I just edited the comment.
icc -> icx
icx
is the new compiler of oneAPI and icl
is the legacy compiler. There is neither icc
nor icpc
presented on oneAPI for windows. However, I can safely confirm that both icx
and icl
are working fine while building with VS 2017. However, still, there is a problem with VS 2019.
@baristelmen I did not know. On linux
, icpc
is still ther:
$ which icpc
/home/th202608/codes/intel/oneapi/compiler/2021.2.0/linux/bin/intel64/icpc
As I understood so far, icpc
is the legacy compiler that will be replaced by icpx
in the future. I didn't pay attention at all to this matter before. Most of the time, I was using default compilers to build programs. The compiler name changes from Windows to Linux.
As per your question yesterday, on Linux with Ubuntu@20.04
and Fedora@v36(container)
, I'm able to build version 3.4.3 with icpx
. I'm going to try 4.0 too.
@baristelmen Thanks again for your time. So I have to add:
intel one API+VisualStudio on windows
icpx
̀ on linux to the list of tested plateforms.
Here is an update for version 4.0 and VS2017. My computer specs are not changed and I didn't update any other compiler yet.
Apparently, in C++17
standards std:unary_function
or std::binary_function
and several other functions are completely removed. For that reason, starting compilation with VS2017
and oneAPI
, the first error is given at the location of;
C:\Apps\tfel\source\4.0\include\NUMODIS\Math\Utilities.hxx on the line 275
\NUMODIS/Math/Utilities.hxx(281): error C2143: syntax error: missing ',' before '<'
The line is as below,
template <class TYPE>
struct Abs : public std::unary_function<TYPE, void> {
//! defines the absolute value function of x
/*! \param x input value */
void operator()(TYPE& x) { x = (x >= 0 ? x : -x); }
};
To bypass or let's say satisfy VS2017 and C++17 requirements, we can define our own unary_function as below.
template<class ArgumentType, class ResultType>
struct spp_unary_function
{
typedef ArgumentType argument_type;
typedef ResultType result_type;
};
And finally, spp_unary_function can be implemented directly to the necessary position,
template <class TYPE>
struct Abs : public spp_unary_function<TYPE, void> {
//! defines the absolute value function of x
/*! \param x input value */
void operator()(TYPE& x) { x = (x >= 0 ? x : -x); }
};
Finally, it compiles and does not complain about the error on version 4.0
with VS2017
using C++17
standards. There are several occasions of std::unary_function
on different files and by creating the template as above, the errors (regarding this matter) have vanished. Unfortunately, I'm not able to evaluate codes behavior yet because I couldn't fully compile yet. Also, I'm not quite sure if the code will work as intended. That I can perhaps evaluate at least with my .mfront
files after full compilation.
There are other compilation errors due to C++17
standards and I will try to check as much as possible I can.
@baristelmen That's a very intersting feed-back. I wasn't aware that std::unary_function
and std::binary_function
were removed from C++-17
. Cool to see that Visual Studio
is more standard compliant than clang
and gcc
. Would you open an issue about this ? Something like "Remove usage of std::unary_function
and std::binary_function
" ?
Of course right away. Apparently on VS2017 with C++17
standards error code C3779
gives error below,
'function': a function that returns 'auto or decltype(auto)' cannot be used before it is defined
This error is affects \include\TFEL/Math/General/ComputeBinaryResult.hxx - line 127
. There are multiple errors on different files regarding this error.
Edit: Mistake
@baristelmen Still don't get it. Line 127 in TFEL/Math/General/ComputeBinaryResult.hxx
is:
using Handle =
std::conditional_t<tfel::typetraits::isInvalid<Result>(),
DummyHandle,
Expr<Result, ObjectScalarOperation<A, B, OpMult>>>;
The only function here is tfel::typetraits::isInvalid<Result>()
andl I don't understand why including the files that you mentionned would help.
@thelfer I believe I spoke too early because I thought the error was vanished however, it just propagated a little bit late. I try to fix it whenever an error is encountered. I took this solution applied via Microsoft's webpage. But, VS complain about this error afterward.
Thus, it was simply a mistake by me. Sorry for that. I'm going to edit the comment.
@baristelmen I fear that this is related to an issue I already encountered with Visual Studio : https://stackoverflow.com/questions/41593649/why-wont-visual-studio-let-me-use-a-templatized-constexpr-function-in-enable-i/41597153
@baristelmen I fear that this is related to an issue I already encountered with Visual Studio : https://stackoverflow.com/questions/41593649/why-wont-visual-studio-let-me-use-a-templatized-constexpr-function-in-enable-i/41597153
You are totally right. As per your comment regarding the VS2017
, the problem persists. However, with VS2019 + fix #104
, I didn't get code C3779
error. Instead, I'm getting different error codes. A piece of the output is below,
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Array/ArrayPolicies.ixx(28,1): error C2734: 'p': 'const' object must be initialized if not 'extern'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/power.hxx(45,35): error C2064: term does not evaluate to a function taking 0 arguments
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Tensor/TensorConcept.ixx(100,3): error C2995: 'enable_if<0,conditional<0,decay<_Ty>::type,MathObjectTraits<decay<_Ty>::type>::value_type>::type>::type tfel::math::trace(const StensorType &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/StensorConcept.hxx(98): message : see declaration of 'tfel::math::trace'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Tensor/TensorConcept.ixx(108,3): error C2995: 'enable_if<0,tfel::typetraits::AbsType<conditional<0,decay<_Ty>::type,MathObjectTraits<decay<_Ty>::type>::value_type>::type>::type>::type tfel::math::abs(const StensorType &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/StensorConcept.hxx(90): message : see declaration of 'tfel::math::abs'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Tensor/TensorConcept.ixx(463,3): error C2995: 'enable_if<0,void>::type tfel::math::computeDeterminantDerivative(StensorResultType &,const StensorType &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/StensorConcept.hxx(136): message : see declaration of 'tfel::math::computeDeterminantDerivative'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Tensor/TensorConcept.ixx(528,3): error C2995: 'enable_if<0,void>::type tfel::math::polar_decomposition(TensorType &,StensorType &,const TensorType2 &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Tensor/TensorConcept.hxx(254): message : see declaration of 'tfel::math::polar_decomposition'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/ST2toST2/ST2toST2Concept.ixx(59,3): error C2995: 'enable_if<0,ComputeUnaryResult<conditional<0,decay<_Ty>::type,MathObjectTraits<decay<_Ty>::type>::value_type>::type,tfel::math::Power<3,1>>::Result>::type tfel::math::det(const TensorType &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Tensor/TensorConcept.hxx(217): message : see declaration of 'tfel::math::det'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/ST2toST2/ST2toST2ConceptPushForward.ixx(52,3): error C2995: 'enable_if<0,void>::type tfel::math::push_forward(ST2toST2Type &,const ST2toST2Type2 &,const TensorType &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/ST2toST2/ST2toST2Concept.hxx(90): message : see declaration of 'tfel::math::push_forward'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/StensorConceptOperations.ixx(44,3): error C2995: 'std::enable_if<0,ComputeBinaryResult<T1,T2,tfel::math::OpDotProduct>::Result>::type tfel::math::operator |(const T1 &,const T2 &)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/StensorConceptOperations.hxx(124): message : see declaration of 'tfel::math::operator |'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/DecompositionInPositiveAndNegativeParts.ixx(102,3): error C2995: 'enable_if<0,void>::type tfel::math::computeStensorPositivePartAndDerivative(DPPType &,PPType &,const StensorType &,const conditional<'function',decay<B>::type,MathObjectTraits<decay<B>::type>::value_type>::type)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/DecompositionInPositiveAndNegativeParts.hxx(47): message : see declaration of 'tfel::math::computeStensorPositivePartAndDerivative'
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/DecompositionInPositiveAndNegativeParts.ixx(426,3): error C2995: 'std::enable_if<0,void>::type tfel::math::computeStensorDecompositionInPositiveAndNegativeParts(DPPType &,DNPType &,PPType &,NPType &,const StensorType &,const conditional<0,decay<StensorType>::type,MathObjectTraits<decay<StensorType>::type>::value_type>::type)': function template has already been defined
30>C:\Apps\tfel\source\4.0-master\include\TFEL/Math/Stensor/DecompositionInPositiveAndNegativeParts.hxx(154): message : see declaration of 'tfel::math::computeStensorDecompositionInPositiveAndNegativeParts'
@baristelmen Just gave VS Community Edition 2022 a try. IMHO, this is going to be a real pain as many features of C++ do not seem to be supported properly. In particular, using constexpr
functions in the evaluation of template arguments seems the root of many errors.
In this case, my fear is to have problems with Abaqus 2021-2022. According to their documentation, their tested and supported platforms are up to VS2019. That's why I was trying on VS2017-2019. In any case, I keep 3.4.3 as a backup solution because my functions are properly working and compiled with VS2017.
As per your comment, I'm, currently, installing VS2022 and going to try immediately. In the meantime, thanks again for all your help and your time on these subjects.
@baristelmen Do not misunderstand me: VS 2022 does not help much for the moment. However, I would be very interested to see if TFEL-4.0+intel one API could work with Abaqus on windows.
@thelfer yes, I understood perfectly. I am willing to give it a try.
I am working on native windows and encountered some errors while compiling Tfel/Mfront using Visual Studio 17. Two of the errors encountered are provided below:
Regards, JWilliams