Pages

Friday, August 5, 2016

Optimizing Your Computer for Fast HEC-RAS Modeling

Written by Christopher Goodell, P.E., D.WRE
and Gary Brunner, P.E., D.WRE  |  Hydrologic Engineering Center
Copyright © The RAS Solution 2016.  All rights reserved. 

Now that 2D modeling is becoming widespread in the HEC-RAS community, a lot of HEC-RAS users are wanting to know what kind of computer to build to maximize computation speed when running those large 2D datasets.  I had an opportunity to interview Gary Brunner about this and he had some valuable insight I’d like to pass along.


Before moving into suggestions for 2D modeling, let me first state that in 1D modeling, multiple processing cores are NOT used.  If you plan to only do 1D modeling, having extra cores will not help you with speed.  In this case, the processor speed is everything.  So get the fastest processor you can (e.g. 3.4 Ghz or higher).

For the rest of this post, I’ll assume you want to optimize your computer for 2D HEC-RAS modeling, since those are the models that typically will take longest to run.
  •  More processing cores is not always better.  In fact, it has been found that for smaller 2D areas (e.g. less than 10,000 cells or so), 8 cores may indeed run slower than 4 or 6 cores.  The reason behind this is that there is a level of computing overhead used just to transfer data between cores.  Fortunately, HEC-RAS has an option to change the number of cores you wish to use in the Computation Options and Tolerances window (from the unsteady flow analysis window…Options…Calculation Options and Tolerances…2D Flow Options tab).  For smaller datasets, I suggest experimenting with this to optimize computation speed.  “All Available” may not necessarily be the fastest.  But for large numbers of cells, you’re going to want as many cores as you can get your hands on.  Get as many cores as you can afford, but not at the expense of processor speed.  Try to get at least 3.2 to 3.4 Ghz or higher processors, no matter how many cores you get.
  • Processor speed is still paramount.  Do NOT think you will have fast HEC-RAS model run times just because you have a computer with 16 processing cores or more.  If all of your cores have slow processor speeds, you’ll get some benefit out of the number of cores, but you will be disappointed in the overall speed for a wide range of model types (1D/2D) and sizes.  So make sure even if you get a large number of cores, you are not doing so at the expense of fast processor clock speeds.  Again, 3.2 to 3.4 GHz or higher is a good clock speed for fast running models. 
  • Your hard drive is important.  Especially if you are producing a lot of output.   Small detailed output intervals, small mapping output intervals, writing computation level output, etc.  All of these settings affect how much and how often output is written to the hard drive during run time.  Solid state hard drives (SSD) are typically going to be better than the traditional spinning hard drive (HDD).
  • RAM is important, but not as much as you might think.  While RAM is definitely important, it is not as important for 2D modeling as number of cores and processor speed.  You do want enough RAM to run your operating system and have your entire HEC-RAS model in memory, without the operating system having to swap things in and out of memory.  That being said, if you plan to do multiple HEC-RAS models at the same time, or you have a habit of keeping lots of programs open and running in the background of your computer, you may want to get a computer with a lot of RAM.    I would venture to guess that if you are buying a computer with a lot of cores with fast clock speeds, your computer will have enough RAM.  But RAM is cheap, so you might as well load up on it while you’re building the HEC-RAS computer of your dreams. 
  • Graphics card does not matter.  While some of your other programs run best on a super-charged graphics card, HEC-RAS does not.  For HEC-RAS modeling, don’t waste your money on an expensive graphics card.  However, you may seem some noticeable improvement in the snappiness of image rendering or particle tracing with a better graphics card.  If money is no object, get a top-of-the-line graphics card, but this is one area you can sacrifice if you need to save some dough. 
To sum up, my recommendation for building a computer to optimize 2D runs in HEC-RAS is as follows:
  • Get as many processing cores as you can, but do not do so in expense of processor speed. 
  • Make sure your computer has processors that are 3.2 to 3.4 Ghz or even higher (the faster the better).  
  • Get an SSD hard drive
  • Max out your RAM.  
Pretty simple really.  And by the way, 24-inch (or larger) dual monitors really helps with viewing all those HEC-RAS windows you have open.  But if you have the means, why stop at two monitors?  


Starting on page 4-11 in the HEC-RAS 2D Manual, there is an interesting discussion on the effect of number of processing cores in computations.  I suggest giving it a read.  There will be a new chapter in the RAS 2D manual due out soon (for version 5.0.2) that will discuss this topic.  

Mr. Brunner has some follow-up advice when buying a computer that has an Intel chip that uses Hyper-threading:

"Hyper-threading is an Intel technology that attempts to keep CPU resources as busy as possible.  Each real CPU core has what appears to be two cores.  However, there is really only one true core.  For example, the typical Intel I7 chip has four real CPU cores, but if you open Task Manager and go to the Performance Tab, you will see four across the top, and what appears to be four more below it.  These are virtual cores.  Each real CPU core has only one true math processing unit, but with Hyper-threading it has two instruction feeders.  Hyper-threading tries to eliminate stalls by always having another thread at the ready in a second virtual core.  If one thread stalls (not requiring the math unit) on virtual core A, virtual core B will instantly start picking up the slack, so the execution units keep working at 100%.

The RAS 2D compute engine is extremely math heavy.  So for each core it utilizes, it is almost always using 100% of the math unit.  So the second virtual core (Hyper-thread) is never used.   So back to our Intel I7 chip example.  An Intel I7 has 4 real cores, but appears to have 8 cores (4 virtual cores).  RAS will only use the four real cores, and it will keep them almost 100% busy.  However, Task Manager reports this as only 50% utilization of the CPU.  However, this is truly 100% utilization of the four real cores math units."

What has been your experience with running fast HEC-RAS simulations on your computer?  Please leave a comment and share with us what you’ve learned about how your computer performs.  In fact, if you have a good picture of your suped up machine running HEC-RAS, please share!


16 comments:

  1. Alienware Laptop 17R3 with a 6820HK processor, 2 SSD x 1 Go, GPU Nvidia 980M, RAM 16 GO and an UHD screen for my precious HECRAS ... That's is the perfect vector for modeling big big modèles (and I love it) !!!

    ReplyDelete
    Replies
    1. Nice!!! Was that the same gigantic laptop you brought to Milan?

      Delete
    2. G'day Stephane. I am looking to purchase a laptop to run 2d hec-ras models on, and am just curious how your alienware is running them these days. Do you think the newest model would be suitable, considering the hyper-threading limitation? Cheers.

      Delete
  2. Stephane have a new big and fast laptop after course in Milan!!!

    ReplyDelete
  3. This was an excellent post..Around here I run a machine with 16gb ram;i7 w/2.4Ghz; HD 1Tb 7200x;nvidia840m(4gb) ;on windows 8.1 and 10 (64bits).
    I´m running models with until 1.8 million cells. Calculations runs ok. But very often errors/crash´s happens when running D*V and Arrival time maps...

    ReplyDelete
  4. Thanks for including Gary Brunner's explanation of how hecras uses (or doesn't use) intel's hyperthreading.

    ReplyDelete
  5. we tried 400,000 cells and it took 12 hours run with this specs: 1 processor
    12 cores per processor
    Intel Xeon E5-2600 v3
    32 TB internal storage
    1.5TB max memory
    3.5 GHz processor frequency

    (4) LFF SAS/SATA/ SSD (8 + 2)
    SFF SAS/ SATA/SSD Hot plug

    ReplyDelete
  6. thanks for giving this great idea

    ReplyDelete
  7. Hi, I just tested a 2D HEC-RAS model in a 32 "real cores" (64 hyperthreated) computer. However, although the software allows me to run it in 32 cores the task manager shows a cpu usage of 25%. Is there a limitation on the maximum number of cores that RAS can use? It looks that the maximum is 8 "real cores".

    ReplyDelete
  8. Running 900,000 cells on a core i9 7900x @4,8Ghz 128GB ram and a Samsung 960 pro SSD, completed in 18 hours

    ReplyDelete
  9. I have an issue trying to run HECRAS on Servers, it is drastically slower running on server than Desktop, just wondering why is that and how to over come it

    ReplyDelete
  10. Hi, is there a way running HEC RAS models on several computers simultaneously? I am thinking about parallel computing. I never did this before, but I heard it is a way increasing the speed of the simulations. At my office we have 3 computers that we could use for this purpose. I ran through your paper entitled "Controlling HEC-RAS using MATLAB" where you describe at the end how to implement the parallelisation on Matlbab. Unfortunately, we do not use Matlab at my office, so I was wondering if there is an alternative (ideally based on open source programs). Many thanks.

    ReplyDelete
    Replies
    1. As HEC-RAS is not open-source, it is likely that there is just no way to parallelize it over several computers (same as for GPU, that's in HEC's hand to implement that for us if they want). However, one thing you could do is to launch several computations at the same time on several computers. This is useful when you run sensitivity analyses for instance, or if you just have to run various scenarios for a project. You'd gain a lot of time and use the power of your colleague's computers while they're not being used, overnight for instance.
      I implemented something like that a while ago, using a calculating environment called Promethee developed by the IRSN (check it online). Unfortunatly it's not publicly available, but you can dig into Promethee's documentation to get the logic of it. It is basically a task scheduler working over a network you have to configure (it could just be a standalone computer), couple it with HEC-RAS so that it knows how to run it (that's when Chris' book about RAS' API comes in handy!), and that's pretty much it. There may be other softwares like Promethee available.

      Delete
  11. Your blog is amazing! I always start at Google but somehow always end up here. Thank you for this information!

    ReplyDelete
  12. I would like to know which is the maximal number of cells in the model you succeeded to run?

    In my case I ran a „rain on grid“-model with 2,2 mil. cells on a machine with 8 gb rams but more is not possible even another workstation with 64 gb rams.

    ReplyDelete

Note: Only a member of this blog may post a comment.