Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fortran vs C
#1
Hi everybody and thanks for reading!
My problem is the following.
I have a Python program that, starting from a state machine (specified in a graphical language), automatically translate it in C-code OR Fortran-code. I compared the two generated codes statically, by code inspection. Now, I would like to compare the equivalence of the two generated codes by comparing the output of their execution, state-by-state.
It means that I want to provide the same input to the C-application and to the Fortran-application and then compare the output at each state of the state machine, during its execution.
To this aim, I was wondering if it is possible to embed in some way the C-code in the Fortran-code or viceversa, so to have one application that contains both codes and when I provide an input I get the output of both of them at the same run.
Is this idea feasable?

Any comments and/or suggestions are welcome.
Thanks in advance!
Reply
#2
I guess you would like to complie, generate Test-Data, getting the output and execution time for both sources in one shoot?

  1. Put you source code an dependencies into a directory, reachable by your script
  2. Use gcc and gfortran to compile the source code
  3. Generate test data
  4. Call the executable, PIPE the data to stdin or as argument (however your program get the data)
  5. Save the stdout and execution time of both programs
  6. Show the stats in your console.

This could even done with a shell script.
You should not put the c or frotran source code into your script.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
Thank you very much! I'm gonna try and let you know...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to debug segfault in ctypes binding to Fortran bthomas 1 568 Sep-01-2023, 11:26 AM
Last Post: bthomas
  f2py: no Fortran compiler found FMJS 2 5,333 May-25-2020, 02:51 PM
Last Post: FMJS
  f2py recovering variables from Fortran module marius 0 3,411 Dec-02-2016, 03:52 PM
Last Post: marius

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020