CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Check license before running on the cluster (

vbaros August 13, 2013 09:09

Check license before running on the cluster
Here is my problem:

I'm running CFX on the Microsoft HPC cluster 2008 R2 without any problems.

The problem I'm having is that the job will fail if there are no licenses available.
I have a general idea how I could create a submission filter for the HPC cluster.

What I would like to do is to be able to check the number of nodes/elements the job is using before job is submitted. Is there an API or a command line tool I could use to check this?

I want to do this because for example, if a job has more than 500000 elements it would require a Research license, <500000 means the jobs would use a student license (if also number of required nodes is <=4).

Can anyone help?

ghorrocks August 13, 2013 19:19

We implemented a license queuing system using PBS here at work. It was not straight forward and needed support from PBS to get it going, but it did work well once set up. I do not know of any easy way of doing it elsewhere - you will probably have to write your own script to call lmstat.exe and parse the returned file and decide whether enough licenses are available.

Lance August 14, 2013 02:04

There is a -preferred-license flag you can use in cfx5solve, but Im not sure how to get the number of nodes/cells in the .def file before running it. You might be able to get it if you run cfx5solve with -check-only and parse the output, if it prints the mesh info.

ghorrocks August 14, 2013 02:33

If you use lmstat.exe it will return the status of the licenses. You can parse that file to extract the currently available number of licenses. Then feed that into PBS or your own gizmo which controls simulation execution and I think you have the question answered. And rather than extract the number of partitions in the def file it will probably be easier to set that when you run it so it is known.

Lance August 14, 2013 02:38

But the question was how to (automagically?) use student licenses when the number of nodes in the mesh was <500 000, and use research licenses for larger jobs. Then s/he need to know the number of nodes in the .def file before submitting the job to the scheduler.

ghorrocks August 14, 2013 02:44

Good point :) Maybe I should read questions a little more closely in future.

You could probably run a CFD-Post session file which loads a def file and returns count()@domain. That might do it.

vbaros August 14, 2013 02:57


Originally Posted by ghorrocks (Post 445597)
Good point :) Maybe I should read questions a little more closely in future.

You could probably run a CFD-Post session file which loads a def file and returns count()@domain. That might do it.

We are on a right track now :)
Can you please write me an example?

ghorrocks August 14, 2013 03:33

How about I tell you how to do it:

Load up CFD-Post, turn on recording a session file. Load up a def file and do a CEL function count()@domain (replace with the domain name). Not sure of the best way to return this value, you will have to try some options.

Also - what about a simple approach. How about you have a script which runs it using the node limited license and if bombs out it runs it again with the full license? This sounds simpler to implement, even if it is less elegant.

Lance August 14, 2013 03:34

here's a session file with some PERL that outputs the number of nodes in Default Domain to tmp.txt


  CFX Post Version = 14.5

  Clear All Objects = false
  Append Results = false
  Edit Case Names = false
  Open to Compare = false
  Multi Configuration File Load Option = Last Case
  Open in New View = true
  Keep Camera Position = true
  Load Particle Tracks = true
  Files to Compare =

  Domains to Load=
> load filename=##YOUR.DEFFILE##, force_reload=\

!$outfile = "tmp.txt";
!open(OUT, ">$outfile");
!$nodes = count("Default Domain");
!print OUT $nodes;

save it as sessionfile.cse and run
cfdpost -batch sessionfile.cse

All times are GMT -4. The time now is 06:00.