General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

ANSYS UPF programms using Intel MKL


    • Aleksandr Zhadkovskii


      I'm trying to implement an algorithm that calculates the principal stresses of the model during its solution to assess damage by some simple criterion "real-time". I am trying to use Intel MKL to do so, but I've come across some problems that I'm not sure how to solve.

      First, I tried using dhseqr to get eigenvalues and then sorting them as principal stresses. However, for some reason, if a call to this function is presented in a compiled block of code in subprograms, solver is unable to converge even if I'm not using a function with this call (I use usermat.F, and I have different subroutine (say, "subroutine eigvalcalc") to calculate principal stresses, in which I call dhseqr). Even if I don't call eigvalcalc inside usermat.F usermat3d, solution fails to converge. If I comment out the line calling dhseqr solution converges just fine. What could be the problem in this case? 

      Secondly, I tried calculating eigenvalues myself. Again, to aid in this, I am using intel-provided functions such as dgemm, dnrm2, ddot, e.t.c. A standalone project in VS compiles and runs just fine, but with ANSYS I'm getting an error when linking saying that ansblas_dgemm, ansblas_dnrm2, e.t.c. can not be found by the linker. My understanding is that ANSYS uses a self-provided BLAS library (ansBLAS.lib can indeed be found in the ANSYS directory), and I've seen include-file redefining calls to functions like dnrm2 to ansblas_dnrm2. How can I overcome this and call Intel-provided functions? Or how can I access ANSYS-provided functions?


      I am using subroutines with the help of the /UPF command and trying to avoid building custom executable. I also edited the ansupf.bat file to include the /Qmkl argument when calling ifort (like "ifort %COMMACS% %FMACS% %COMSWITCH% %FSWITCH% %MACS64% /Qmkl *.F   >>compile.log 2>&1").

      Versions of Intel Fortran Compiler and Intel MKL are the last ones at the moment provided in intel oneAPI (2023.2.0).

      Thanks in advance.

    • David Weed
      Ansys Employee

      Hi Aleksandr,

      Can you specify which version of ANSYS you are using and on what platform (Win/Linux)? Please note that we do not currently support usage of Intel OneAPI for compiling/linking and we also do not recommend modifying the ansupf.bat file.

      • Aleksandr Zhadkovskii


        I’m using 22R1 on Windows. Unfortunately, I have to use one API, as other versions are harder to find nowadays. ansupf.bat has to be slightly adjusted as paths there are for compiler from Parallel Studio, I think.

        I rewrote my subroutines to calculate eigenvalues with a simple QR-algorithm while using only Ansys provided subroutines (as vmult, vnorm, e.t.c.); however, I cannot find a subroutine for matrix multiplication, and I believe my subroutine for this and the method itself are kind of slow, so it’s not a perfect solution. Are there any substitutes for Intel MKL libraries? Maybe I can use the ANSYS-provided BLAS-libraries AnsBLAS as I believe they should be similar.

        Alternatively, I avoided using a custom executable and tried using only the /UPF-method, but maybe there are variants to get principal stresses in usermat during solution while using custom executable? I’ve seen the ensget function; however, the return (value) of this function was kind of weird, and I was not sure if it was correct.


        • David Weed
          Ansys Employee


          The supported IFORT compiler and MS VS versions for 22R1 for Windows:

          Microsoft Visual Studio Professional 2019 Version 16.0.22 (including the MS C++ compiler), Intel C++ and Intel Visual FORTRAN 2019 Update 5 (2019.5.281)

          For Linux:

          Intel 2019.3 Parallel Studio XE (FORTRAN, C, C++) and GCC 8.2.0 (for user programmable features)

          We currently don’t support OneAPI and it could produce unexpected results. I know that there were some changes made to the Intel site and it can be difficult to find older versions, but if you have an Intel subscription, you can consider reaching out to their support team.

          Regarding the ensget function, this will only work post solution. You may want to try NDSPGT which is valid during the solution. Also, note that NDSPGT may require the common block If you’re on the Windows platform, then you’ll need to use the custom executable method in order to pull information from the common blocks. Using the /UPF method will require the invocation of additional data sharing routines. It’s easier to use a custom exe instead. On the Linux platform, data sharing from the common blocks isn’t an issue, so you may use the /UPF or shared library method with no issue when using NDSPGT.

          I’d have to check into BLAS/AnsBLAS libraries to see if they can be used.

        • Aleksandr Zhadkovskii


          Thanks for the answer!

          So that’s why ensget values were bad. I’ll check on how to use subroutines in post, as it’s not crucial whether I’m calculating a criterion during solution or in post.

          Regarding the use of the AnsBLAS library, at the end of every solution in ANSYS, the next information is printed:

          Compiler: Intel(R) Fortran Compiler Version 19.0.5  (Build: 20190815)
                    Intel(R) C/C++ Compiler Version 19.0.5  (Build: 20190815)
                    Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191125
                    BLAS Library supplied by Intel(R) MKL

          So, I believe that BLAS is used at least in some capacity. However, I’m not sure how to call it (due to the error stated in the original post), so I’m looking forward to information considering this!

          EDIT: Also, a follow-up question: are there any examples of post-subroutines? I cannot seem to find them.


Viewing 1 reply thread
  • You must be logged in to reply to this topic.