Author Topic: How do I measure the time it takes to iterate in Fluent?  (Read 6052 times)

Offline pico

  • Newbie
  • *
  • Posts: 19
  • Reputation: +0/-0
  • Searching for solution
    • View Profile
How do I measure the time it takes to iterate in Fluent?
« on: February 12, 2012, 12:32:44 PM »
Advertisement
How do I measure the time it takes to iterate in Fluent?

Offline william

  • Full Member
  • ***
  • Posts: 159
  • Reputation: +15/-0
  • Know it, share it.
    • View Profile
Re: How do I measure the time it takes to iterate in Fluent?
« Reply #1 on: February 12, 2012, 12:33:25 PM »
If you are running the parallel version of the code, you can use the
Parallel->Timer feature.

Note: You can run the parallel version of the code on only one processor to use this functionality to measure fluent operating on one computer node. There is additional overhead though using the parallel version in this fashion, and the results will not be exactly the same as the method mentioned below.

For the serial solver, you can measure the time spent iterating in Fluent through the use of the scheme file (appended)
(After downloading, please rename the file: benchmark.scm)


Use the Graphical User Interface to load the file, benchmark.scm.
File->Read->Scheme

After the case is set up and ready to run, enter this command to start and time the iterations in the Text User Interface. Please pay close attention to the syntax and replace the string NO_OF_ITERATIONS with the desired number of iterations to be performed:

(benchmark '(iterate NO_OF_ITERATIONS))

example to run for 10 iterations:

(benchmark '(iterate 10))

The results will be of the form:

cpu-time: cortex=0.04, solver=0.3
elapsed-time: 0.51880407

This shows the elapsed, wall clock time for the iterations and the cpu-time used in the solver and cortex. The cortex is the process controlling the solver and user interface.

Scheme File :

;;;save this as benchmark.scm
;;; Copyright 1991-1994 Fluent Inc.
;;; All Rights Reserved.
;;;
;;; This is unpublished proprietary source code of Fluent Inc.
;;; It is protected by U.S. copyright law as an unpublished work
;;; and is furnished pursuant to a written license agreement. It
;;; is considered by Fluent to be confidential and may not be
;;; used, copied, or disclosed to others except in accordance with
;;; the terms and conditions of the afore mentioned agreement.
;;
;; Reports CPU times of Cortex and solver processes for specified function.
;; Example: (benchmark '(iterate 50))

(define (benchmark thunk)
(let ((t0/cortex)
(t0/solver)
(t0/clock)
(t1/cortex)
(t1/solver)
(t1/clock)
(result))
(set! t0/clock (time))
(set! t0/solver (cx-send '(cpu-time)))
(set! t0/cortex (cpu-time))
(set! result (eval thunk user-initial-environment))
(set! t1/cortex (cpu-time))
(set! t1/solver (cx-send '(cpu-time)))
(set! t1/clock (time))
(format "cpu-time: cortex=~a, solver=~a~%elapsed-time: ~a~%"
(- t1/cortex t0/cortex)
(- t1/solver t0/solver)
(- t1/clock t0/clock))
result))