Julio Mendez

JM

CFD Scientist and HPC expert specialized in CFD solver development for compressible flows and turbulence modeling.

Location USA

Activity

  • Julio Mendez made a comment

    the best training ever !!!

  • Julio Mendez made a comment

    For me Fortran is the best language to do scientific applications, Even Bjarne Stroustrup mentioned that once, Fortran was done for scientists and engineers who only wanted to do one specific thing computations. It took off the burden of the complexity of the underlined system that prevented (made it harder) doing science. Unfortunately, libraries are limited...

  • I have found that MPI provides better performance. For example, I remember I had 128 Cores and the OpenMP did not perform as good as the MPI application on the same node with 128 cores. The performance difference was not that high honestly. However, updating your application to OpenMP is very simple compared to MPI.

  • Yes a lot, I use MPI and OpenMP most of the time. OpenACC also when I have access to GPUs. Unfortunately, I have not found an efficient way to do MPI+OpenMP. The performance I have gotten combining them is negligible. So I stick to MPI purely, and OpenMP when I am doing Post-processing or when working with arrays.

  • Not relevant for this conversation but I remember I needed to do some energy spectrum calculation in the past for some turbulent flows runs. I was about to start writing the FFT sections and one of my seniors told me "Do yourself a favor and use Matlab for that. It is not worth the time to do it in Fortran. Always use libraries". I used Matlab at that time and...

  • Yes, I was very new to MPI when I started working on a full real CFD full flesh application with MPI. The idea was to convert an old code to MPI. It was not clear why my communication was sending and receiving different elements until I remembered that Fortran is column-wise. So, even though I was "sending" and receiving columns, the MPI data type was not. It...

  • @GeertJanBex You are right !! I remember once that just including the MPIIO reduced the time of the entire runtime almost by half. I was doing LES and therefore one needs to save partial results. I/O is a fundamental part of turbulence modeling, and with MPI, is another level!

  • I thought that -O3 forced the vectorization.

  • I liked the last part Copy/Paste is evil. I wonder if procedures can also be used instead of just copying and pasting. You mentioned functions only, so that makes me wonder if procedures (subroutines) are also another alternative.

  • Julio Mendez made a comment

    I am so sorry, I still have trouble getting the dynamics of pointers. Here I go again, please folks bear with me. I can just replicate this, but if I don't understand it I won't ever remember.
    In the first section "Pointers Basic", swap example, I see that the inner loop is referencing pA_new, and pA, and performing some operation. This makes me think that...

  • Julio Mendez made a comment

    For the record, I tested the two versions shown in the "Pointer Basic" and the version with pointer is almost 2 times faster. Wow, I never thought that was possible with pointers. I am still struggling with it, but I'll bang my head enough until it really sinks in my mind. I have a bunch of swap statements in my CFD solvers that will be definitely updated with...

  • Julio Mendez made a comment

    Sorry for the possible several questions in this unit, but I cannot wait until the end of the lecture to post all questions.

    ----- Pointer Basics ----

    1.- Are pointers less memory efficient ? In the first example, we only have 2 arrays. In the pointer example, we started with the same arrays + 3 new pointers. Thus, more memory needs to be allocated,...

  • Two questions, what does value do in the variable declaration ?
    for example:
    integer, value :: array_size

    another one, I saw you used stop 2, and also stop 101. What are the objective of these two ?

  • Just to be clear... once the application ends, the memory address space provided to the application through "allocate" will be returned back to the OS, right ? so, where does the garbage collection come from ?

  • Julio Mendez made a comment

    I've always had the question about the performance of dynamic arrays. I learned that as long as you do not allocate ad deallocate them then the performance is exactly the same as their counterpart of defining the size upfront.

  • Julio Mendez made a comment

    I can't understand the first application. Any other help over here ?

  • I have not used CMake before, only in this course and I wonder about the difference between CMake and makefiles. I've used the latter and I do not see where they really differ from each other.

  • Julio Mendez made a comment

    What do you mean by multiple applications ?

  • Separate files, for sure... I've worked exclusively in CFD applications so I cannot make comments about other kinds of applications. But, I feel that is quite difficult to manage everything in one long file. Nonetheless, I think that all boils down to preferences. I prefer one file per subortuine.

  • I think this is one of the features why C++ made its way through in scientific programming. Fortran took so much time to develop this important feature, that many people are not aware of.

  • not only that. I feel that Fortran gives you the opportunity to write an application fast, not to run the application fast. It is a complex language but not as complex as C/C++. you can get away with it pretty nice and still get a great performance. I recently attended an HPC workshop where the instructor literally said "Sorry but if you want to do HPC...

  • I think that either definition has been widely replaced by the simplest parallelization available, shared memory, openMP. Initially, do concurrent and forall were thought (as Gary Klimowicz) mentioned being useful for parallel processors.

  • @GeertJanBex Sorry, I referred to question 6 from the 2.17 quiz

  • The quiz xope_02, shouldn't it be 2 7, 3 5 ? The variables defined within the block exist only within the block. Did I miss something ?

  • Julio Mendez made a comment

    Here, I am a little bit confused. i tried to find the lecture where we saw that Fortran is "pass by reference" and printing a variable before and after the "call" of the function showed that the variable was modified in the function. I did not find the lecture.
    So, if we declare the variable within the function is it like defining the variable as "value"...

  • Classmates. In more than 10 years of CFD solver development for academic purposes, I have not ever used this debugger, and I do not feel proud of it. On the contrary!! I've always used the trick of "print*," and started a tedious inspection and trace of errors that are difficult to find. This lecture has been quite interesting and an eye-opener for me !!...

  • I'd say a recursive function will be always faster if you do not explicitly parallelize it. The compiler is way smarter than us (at least me). Am I right ?

  • Julio Mendez made a comment

    Am I missing soemthing ? but a pure subroutine is not else but a function.
    In layman's terms, what is a side effect ?

  • Functions return one thing, while subroutine can be used to change many things. For example, I tend to declare all my variables in one module, and divide the whole code into "tasks" that go into different subroutines. Since I include the module in all subroutines, I can use each file (subroutine) to perform a specific task, e.g: viscous fluxes, inviscid...

  • sweet isn't it? let Fortran do what it was meant to do... Matrix stuff!!! I did not know about elemental functions and they are indeed powerfull. I imagine that computing stress tensors are quite straightforward with this feature.

  • for the record:
    No optimization:
    timing 1 3.99956480E-06
    timing 2 9.99774784E-07

    with optimization (-O3), it was quite similar...

    of course, I should have run this multiple times and taken the average..

  • Julio Mendez made a comment

    Sorry, there is a slow mind over here (me).. I remember that I had an extremely clever mate when I was doing my Ph.D. who loved to write codes with instruction ultra-short and efficient. Every time I used his codes I ended up spending a lot of time just understanding some of the loops... For me, loops must be simple to understand.. I've always had a hard time...

  • Julio Mendez made a comment

    One thing I have experienced in Fortran (perhaps it is compiler dependent) is using Array (1,:) to select rows in general, and Array (:,1) for columns. This is just an example. I've used it in the past, t assign boundary conditions, to be more specific. The outcome was always totally unpredictable and hard to catch. I decided to explicitly do Array(1, 1:JMAX),...

  • I love the simplicity of Fortran

  • @GeertJanBex did you get the best performance with the iterative procedure ? when I ran these, the best performance was with the memoization procedure.

  • Thanks for the information, it is interesting to learn how save helps one to retain the values previously computed. Thanks for the info about its performance with integers, that is good to know. Nonetheless, the memoized delivers the fastest computation, followed by iterative, 0.0004120, and 0.0345490, respectively. I imagine you refer to the interative...

  • Me too, every time I've tried, I have just given up !!

  • I am not familiar with recursive either, but I imagine that you can recursively call the same function, even within the function. Am I right ?
    Also, I am a little bit lost with your implementation of the recursive function fib_memoization(n). I wonder if the fact that you are using an array enhances cache hits. However, every time the function is called, I...

  • Thanks!!

  • I've tried to reproduce the exercises, but I found quite illustrative the source codes on GitHub. Such a clever way to do things !! Not sure how the elemental function works on the array xn.

  • The best training on modern Fortran !!! Difficult to see this style on the CFD arena!

  • @VikasSharma Totally agree with you, and here I will cite Bjarne Stroustrup's words (kind of) "Fortran was created for scientific computation and it was the first language to reduce the complexity to do so".
    You can do things in Fortran very simply and straight, and still, I see the scientific community (in the USA at least) demonizing Fortran programmers....

  • This refreshing course reminds me why I chose Fortran for my scientific journey more than a decade ago. Although my style is not the most effective, I hope to correct those bad habits I have/had because of the lack of proper training and education.

  • Julio Mendez made a comment

    I did not quite get the use of " stop 1" when we check for errors. I did not get that either in the previous lesson.
    Will :
    write (unit=error_unit, fmt='(2A)') 'error: ', trim(msg)

    write to a separate error file or the screen ?

    This info is quite valuable and not available in my old Fortran textbook. What books can we use for future references for...

  • Julio Mendez made a comment

    Indeed, I/O is as important as the other intensive computing parts. Indeed, for HPC, I'd say this is even more important because of the time you spend I/O in very expensive computer systems. I remember, I spent weeks writing an I/O subroutine with MPIIO for one source code I have for CFD. It increased the performance dramatically because I had very frequent I/O.

  • Good point about converting constants to single, once they are declared as double. I never thought about it !!
    I imagine this applies when you have declared variables SP and DP. I imagine that in this instance you will have trouble. But, if all variables are declared as DP, then no conversion is done by the compilers. Am I right ?
    Thanks!

  • I have a question here. I saw that you are defining the kind for each variable upfront in a very elegant and simple way. More specifically, you are setting:

    use, intrinsic :: iso_fortran_env, only : &
    SP => REAL32, DP => REAL64
    implicit none
    real(kind=SP) :: x_sp
    real(kind=DP) :: x_dp

    However, later on you assigned,
    ...

  • I am a mechanical engineer with a MSc and Ph.D. in Mechanical Engineering with a concentration in Computational Fluid Dynamics. I have developed CFD solvers for academic applications in Fortran 90, mostly for supersonic/hypersonic flows and Turbulence modeling using LES. These CFD solvers have been developed for HPC applications using MPI, OpenACC, and also...

  • I have been using Fortran since 2007. In fact, my first exposure was to Fortran 77 and I was very overwhelmed with all the details needed. Today, I am very fortunate to have had that exposure. I am very happy to joined this course for a fresh review of Fortran and OOP, FOR SCIENTIFIC COMPUTING, which is quite difficult to find.