ComplicatedPhenomenon / Fortran_training

Other
0 stars 1 forks source link

Unsolicited advice for new Fortraner #2

Open szaghi opened 7 years ago

szaghi commented 7 years ago

Daer @complicatephenomenon ,

It seems that you are learning Fortran programming language (if not, please forgive me). This language is, in my opinion, the best one for formula translation: I am focused on math/physics thus programming is tool not the aim. Fortran allows to achieve clearness, conciseness, portability and efficiency even to not expert programmers like me. You can achieve most of the same goals with C, but you have to be a very good expert programmer distracting your self from math/physics... You can achieve clearness and conciseness in Python, but you have to say good bye to performance... You can achieve the same goals with Julia, but it is a very young programming language compared to Fortran that is still playing after 60 years. This boring introduction is devoted to only convey the idea that Fortran is really a good option for mathematicians and physicists, please consider it even the first approach could seem frustrating.

I am giving such an unsolicited advice because reading your Fortran repositories I see that you are using a strange mixture of old concepts (Fortran born in 1954...) and modern ones. If you a new Fortraner (as I hope), you should learn the so called modern Fortran (no worries, Fortran is essentially bacward compatible, it is highly probable that you can successful compile/ran code of 50 years ago with modern compilers): modern Fortran allows for a lot of modern programming style that help your daily programming life, e.g. OOP, allocatable, modularization, abstraction! This is not our parents Fortran, Fortran could be modern as much as Python (not as fancy, but quite friendly). In the meanwhile Fortran retains its main advantage, it is really efficient, the fastest in the west. So, this is the unsolicited advice:

start learning modern Fortran not the Fortran of our parents.

With modern Fortran you can focus on what counts, math/physics, e.g.

https://github.com/Fortran-FOSS-Programmers/FOODIE

https://github.com/Fortran-FOSS-Programmers/FOODIE/wiki/High-Level-Programming

https://github.com/Fortran-FOSS-Programmers/WenOOF

https://github.com/francescosalvadore/openpde

https://github.com/szaghi/FORESEER

https://github.com/szaghi/OFF/tree/testing

There are many books that are a good starting point, let me know it you are interested and let me know if you like to join our Fortran group where interesting discussion about fortran are usual.

Good luck!

My best regards.

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi, It's great to receive this email, I really appreciate your precious advice, and yes, I am a new Fortraner, so it's not strange that my Fortran code contained both modern and old concepts, I haven't yet formed a consistent coding style.

I am learning the basics of Fortran.I read Fortran Tutorial and another reference book mainly about Fortran90 and then practice.

After doing several basic practices, I looked for great Fortran code to deepen my understanding.

I am interested in Fortran programming, and hope can make obvious progress.

It will be great if you can recommend me better starting books . I would love to join your Fortran group, but I am still innocent now, I have no idea what I can do in the Fortran group.

Anyway, thank again.

Best wishes!

My best regards!

------------------ Original ------------------ From: "Stefano Zaghi";notifications@github.com; Send time: Saturday, Apr 15, 2017 2:00 PM To: "complicatephenomenon/fortran_program"fortran_program@noreply.github.com; Cc: "王妙"wm.nizaina@foxmail.com; "Mention"mention@noreply.github.com; Subject: [complicatephenomenon/fortran_program] Unsolicited advice for newFortraner (#2)

Daer @complicatephenomenon ,

It seems that you are learning Fortran programming language (if not, please forgive me). This language is, in my opinion, the best one for formula translation: I am focused on math/physics thus programming is tool not the aim. Fortran allows to achieve clearness, conciseness, portability and efficiency even to not expert programmers like me. You can achieve most of the same goals with C, but you have to be a very good expert programmer distracting your self from math/physics... You can achieve clearness and conciseness in Python, but you have to say good bye to performance... You can achieve the same goals with Julia, but it is a very young programming language compared to Fortran that is still playing after 60 years. This boring introduction is devoted to only convey the idea that Fortran is really a good option for mathematicians and physicists, please consider it even the first approach could seem frustrating.

I am giving such an unsolicited advice because reading your Fortran repositories I see that you are using a strange mixture of old concepts (Fortran born in 1954...) and modern ones. If you a new Fortraner (as I hope), you should learn the so called modern Fortran (no worries, Fortran is essentially bacward compatible, it is highly probable that you can successful compile/ran code of 50 years ago with modern compilers): modern Fortran allows for a lot of modern programming style that help your daily programming life, e.g. OOP, allocatable, modularization, abstraction! This is not our parents Fortran, Fortran could be modern as much as Python (not as fancy, but quite friendly). In the meanwhile Fortran retains its main advantage, it is really efficient, the fastest in the west. So, this is the unsolicited advice:

start learning modern Fortran not the Fortran of our parents.

With modern Fortran you can focus on what counts, math/physics, e.g.

https://github.com/Fortran-FOSS-Programmers/FOODIE

https://github.com/Fortran-FOSS-Programmers/FOODIE/wiki/High-Level-Programming

https://github.com/Fortran-FOSS-Programmers/WenOOF

https://github.com/francescosalvadore/openpde

https://github.com/szaghi/FORESEER

https://github.com/szaghi/OFF/tree/testing

There are many books that are a good starting point, let me know it you are interested and let me know if you like to join our Fortran group where interesting discussion about fortran are usual.

Good luck!

My best regards.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

szaghi commented 7 years ago

Hi @complicatephenomenon

I am happy to read that a new Fortraner is born :smile:

I am now out of office, thus let me amend the following list the next week, but surely some books I loved are:

For the group joining do not worry: the aim of the group is not (only) to develop good Fortran projects together, rather the joining of people having very different background that share their own knowledge for the benefit of all and that have in common only the usage of Fortran. You do not need to master Fortran for joining us, only the idea sharing is required. You will learn a lot from some of the members (not me, I am the donkey of the group). I will send you the invitation soon.

Cheers

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi, Many thanks for your suggestions time and invitation, I couldn't have felt more glad.

Cheers
My best regards

------------------ Original ------------------ From: "Stefano Zaghi";notifications@github.com; Send time: Sunday, Apr 16, 2017 2:22 PM To: "complicatephenomenon/fortran_program"fortran_program@noreply.github.com; Cc: "王妙"wm.nizaina@foxmail.com; "Mention"mention@noreply.github.com; Subject: Re: [complicatephenomenon/fortran_program] Unsolicited advice for newFortraner (#2)

Hi @complicatephenomenon

I am happy to read that a new Fortraner is born ?

I am now out of office, thus let me amend the following list the next week, but surely some books I loved are:

Scientific Software Design: The Object-Oriented Way, Damian Rouson, Jim Xia Xiaofeng Xu, Cambridge University Press New York, NY, USA ?2011, ISBN:0521888131 9780521888134

Modern Fortran: Style and Usage, Clerman, Norman S. and Spector, Walter (2012), Cambridge University Press.

Modern Fortran in Practice, Arjen Markus, Cambridge University Press New York, NY, USA ?2012, ISBN:1107603471 9781107603479

For the group joining do not worry: the aim of the group is not (only) to develop good Fortran projects together, rather the joining of people having very different background that share their own knowledge for the benefit of all and that have in common only the usage of Fortran. You do not need to master Fortran for joining us, only the idea sharing is required. You will learn a lot from some of the members (not me, I am the donkey of the group). I will send you the invitation soon.

Cheers

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

szaghi commented 7 years ago

Hi @complicatephenomenon

I like to add also this book

Guide to Fortran 2008 Programming 2nd ed. 2015 Edition, Walter S. Brainerd

I have not read it, but it seems to be a good introduction.

My preferred (but not really introductory) is Modern Fortran: Style and Usage and, when you know a bit more of Fortran Language my favorite is Scientific Software Design: The Object-Oriented Way.

Feel free to ask for any help.

Good readings!

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi I have a problem about function in Fortran, because too long Every expression is(about hundreds of Kb), breaking it down and paste it into the source file seems to be an improper way, Do you have any idea to address this problem, any help will be appreciated.

Sincerely

szaghi commented 7 years ago

Dear @ComplicatedPhenomenon

I think I could help, but I have indeed only an obfuscated idea of your problem driven only by the stackoverflow discussion you linked. Your sentence

because too long Every expression is(about hundreds of Kb), breaking it down and paste it into the source file seems to be an improper way

is really unclear for me. Can you elaborate more on it, maybe providing a small example even in pseudo code?

The stackoverflow questions seems to be not completely answered, i.e. it seems that passing functions as dummy arguments (by means of interface) has been neglected while it could be helpful. However, I cannot say what can help you because I did not understand your problem :cry:

Sorry, but I need more infos

Cheers

szaghi commented 7 years ago

Dear @ComplicatedPhenomenon

I wrote a small example of what (I guessed) could be helpful in a scenario like the stackoverflow one. Let us assume that your problem is a work dispatcher, namely based on some user selections the woker must execute different functions. These functions are complicated as you want, thus you do not want to write all of them inside the worker. The solution could be similar to the following:

module module_functions
   ! Define functions.
   use, intrinsic :: iso_fortran_env, only : R8P=>real64
   implicit none
   private
   public :: my_function
   public :: my_cos
   public :: my_sin
   public :: my_exp

   abstract interface
      ! Define the function prototype. Define as many interfaces as you need.
      function my_function(x) result(my_result)
         ! Define the interface of my function prototype.
         import :: R8P
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.
      endfunction my_function
   endinterface

   contains
      function my_cos(x) result(my_result)
         ! Just a function of mine: this could be complicated as you want.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         my_result = cos(x)
      endfunction my_cos

      function my_sin(x) result(my_result)
         ! Just a function of mine: this could be complicated as you want.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         my_result = sin(x)
      endfunction my_sin

      function my_exp(x) result(my_result)
         ! Just a function of mine: this could be complicated as you want.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         my_result = exp(x)
      endfunction my_exp
endmodule module_functions

module module_worker
   ! Define worker.
   use, intrinsic :: iso_fortran_env, only : R8P=>real64
   use module_functions
   implicit none
   private
   public :: worker

   contains
      subroutine worker(selection, x, work, function_a, function_b, function_c)
         ! Work dispatcher. This is unnecessary complicated, only to show some features.
         character(len=*),       intent(in)  :: selection  ! User selection.
         real(R8P),              intent(in)  :: x          ! The independent abscissa.
         real(R8P),              intent(out) :: work       ! Work result.
         procedure(my_function), optional    :: function_a ! Function "a".
         procedure(my_function), optional    :: function_b ! Function "b".
         procedure(my_function), optional    :: function_c ! Function "c".

         select case(trim(adjustl(selection)))
         case('a')
            if (present(function_a)) then
               work = function_a(x=x)
            else
               error stop 'error: "function_a" has been selected but not passed'
            endif
         case('b')
            if (present(function_b)) then
               work = function_b(x=x)
            else
               error stop 'error: "function_b" has been selected but not passed'
            endif
         case('c')
            if (present(function_c)) then
               work = function_c(x=x)
            else
               error stop 'error: "function_c" has been selected but not passed'
            endif
         case default
            ! use the first passed function
            if (present(function_a)) then
               work = function_a(x=x)
            elseif (present(function_b)) then
               work = function_b(x=x)
            elseif (present(function_c)) then
               work = function_c(x=x)
            else
               error stop 'error: no selection neither function have been passed'
            endif
         endselect
      endsubroutine worker
endmodule module_worker

program dispatcher
   ! Test work dispatcher.
   use, intrinsic :: iso_fortran_env, only : R8P=>real64
   use module_functions
   use module_worker
   implicit none

   real(R8P) :: work

   call worker(selection='a', function_a=my_sin, function_c=my_cos, x=0._R8P, work=work)
   print*, 'sin(0) = ', work

   call worker(selection='c', function_a=my_sin, function_c=my_cos, x=0._R8P, work=work)
   print*, 'cos(0) = ', work

   call worker(selection='exp', function_b=my_exp, x=0._R8P, work=work)
   print*, 'exp(0) = ', work

endprogram dispatcher

Upon the execution you obtain

stefano@thor(06:39 AM Thu May 25)
~/downloads/complyph 4 files, 48Kb
→ a.out 
 sin(0) =    0.0000000000000000     
 cos(0) =    1.0000000000000000     
 exp(0) =    1.0000000000000000

The above example shows (with unnecessary complications) some features about how to pass procedures (functions in this case) to other procedures, that is the common task in the assumed scenario.

I'll look forward for your feedback, I hope mine was not completely off topic.

Cheers

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi Thank you very much for your help.
In the program you gave, there is three lucid functions contained in module module_functions, what if the concrete function is not as short as my_result = cos(x), it is too long that I save it in a file instead of paste into the source file , I mean, my_result = cos(x)+cos(x)**2+cos(x)**3+2cos(x)+..., I can't write a very long expression right into the code,right? Then how to pass this long function to another procedures?
Have I made the problem clear? Sorry for my poor ability of expression in English. Best Wishes

szaghi commented 7 years ago

Dear @ComplicatedPhenomenon

It is now much more clear.

Sorry for my poor ability of expression in English.

Your English is a quantum leap with respect mine, do not worry.

what if the concrete function is not as short as my_result = cos(x), it is too long that I save it in a file instead of paste into the source file , I mean, my_result = cos(x)+cos(x)**2+cos(x)**3+2cos(x)+...

As I said in the comments of the example, this is not really a problem, the functions can be as complicated as you want. Some preliminary considerations:

Let us assume that your expression function is incredibly complicated and you want to handle it separately from the Fortran sources, say by means of a pre-processor: no matter how complicated it is, at some point, by means of your pre-processing workflow you have to end up with an expression like my_result = cos(x)+cos(x)**2+cos(x)**3+2cos(x)+..., but you prefer to not put it directly into the sources rather handling it by means of your pre-processor.

In this scenario, what you would like to do is to exploit include built-in. A simple example follows:

module module_functions
   ! Define functions.
   use, intrinsic :: iso_fortran_env, only : R8P=>real64
   implicit none
   private
   public :: my_function
   public :: my_cos
   public :: my_sin
   public :: my_exp
   public :: my_comply

   abstract interface
      ! Define the function prototype. Define as many interfaces as you need.
      function my_function(x) result(my_result)
         ! Define the interface of my function prototype.
         import :: R8P
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.
      endfunction my_function                                                                                                
   endinterface                                                                                                              

   contains                                                                                                                  
      function my_cos(x) result(my_result)
         ! Just a function of mine: this could be complicated as you want.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         my_result = cos(x)
      endfunction my_cos

      function my_sin(x) result(my_result)
         ! Just a function of mine: this could be complicated as you want.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         my_result = sin(x)
      endfunction my_sin

      function my_exp(x) result(my_result)
         ! Just a function of mine: this could be complicated as you want.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         my_result = exp(x)
      endfunction my_exp

      function my_comply(x) result(my_result)
         ! Just a complicated function handled by external preprocessor.
         real(R8P), intent(in) :: x         ! The independent abscissa.
         real(R8P)             :: my_result ! The result of my function.

         include 'comply_expression.inc'
      endfunction my_comply
endmodule module_functions

module module_worker
   ! Define worker.
   use, intrinsic :: iso_fortran_env, only : R8P=>real64
   use module_functions
   implicit none
   private
   public :: worker

   contains
      subroutine worker(selection, x, work, function_a, function_b, function_c)
         ! Work dispatcher. This is unnecessary complicated, only to show some features.
         character(len=*),       intent(in)  :: selection  ! User selection.
         real(R8P),              intent(in)  :: x          ! The independent abscissa.
         real(R8P),              intent(out) :: work       ! Work result.
         procedure(my_function), optional    :: function_a ! Function "a".
         procedure(my_function), optional    :: function_b ! Function "b".
         procedure(my_function), optional    :: function_c ! Function "c".

         select case(trim(adjustl(selection)))
         case('a')
            if (present(function_a)) then
               work = function_a(x=x)
            else
               error stop 'error: "function_a" has been selected but not passed'
            endif
         case('b')
            if (present(function_b)) then
               work = function_b(x=x)
            else
               error stop 'error: "function_b" has been selected but not passed'
            endif
         case('c')
            if (present(function_c)) then
               work = function_c(x=x)
            else
               error stop 'error: "function_c" has been selected but not passed'
            endif
         case default
            ! use the first passed function
            if (present(function_a)) then
               work = function_a(x=x)
            elseif (present(function_b)) then
               work = function_b(x=x)
            elseif (present(function_c)) then
               work = function_c(x=x)
            else
               error stop 'error: no selection neither function have been passed'
            endif
         endselect
      endsubroutine worker
endmodule module_worker

program dispatcher
   ! Test work dispatcher.
   use, intrinsic :: iso_fortran_env, only : R8P=>real64
   use module_functions
   use module_worker
   implicit none

   real(R8P) :: work

   call worker(selection='a', function_a=my_sin, function_c=my_cos, x=0._R8P, work=work)
   print*, 'sin(0) = ', work

   call worker(selection='c', function_a=my_sin, function_c=my_cos, x=0._R8P, work=work)
   print*, 'cos(0) = ', work

   call worker(selection='exp', function_b=my_exp, x=0._R8P, work=work)
   print*, 'exp(0) = ', work

   call worker(selection='a', function_a=my_comply, x=0._R8P, work=work)
   print*, 'comply(0) = ', work

endprogram dispatcher

The included file looks like

cat comply_expression.inc
 my_result = cos(x) +      &
             cos(x) ** 2  + &
             cos(x) ** 3  + &
             cos(x) ** 4  + &
             cos(x) ** 5  + &
             cos(x) ** 6  + &
             cos(x) ** 7  + &
             cos(x) ** 8  + &
             cos(x) ** 9  + &
             cos(x) ** 10 + &
             cos(x) ** 11 + &
             cos(x) ** 12 + &
             cos(x) ** 13 + &
             cos(x) ** 14 + &
             cos(x) ** 15 + &
             cos(x) ** 16 + &
             cos(x) ** 17 + &
             cos(x) ** 18 + &
             cos(x) ** 19 + &
             cos(x) ** 20 + &
             cos(x) ** 21 + &
             cos(x) ** 22 + &
             cos(x) ** 23

Upon the execution I obtain

┌╼ stefano@zaghi(09:43 AM Thu May 25)
├───╼ ~ 31 files, 6.7Mb
└──────╼ a.out
 sin(0) =    0.0000000000000000
 cos(0) =    1.0000000000000000
 exp(0) =    1.0000000000000000
 comply(0) =    23.000000000000000

Note two important things

  1. the worker has not been changed;
  2. the complicated function can be handled externally, it existing into the the included comply_expression.inc file.

Now suppose you want a more handy workflow where you have not to write by hand your complicated expression. This can be easily done by means of very simple Python scripts. For example, if your complicated expression is driven by a symbolic calculus writing a Python script to generate the above comply_expression.inc is very easy. If you need help for this part of the pre-processing workflow I can help if you like to go with Python.

Cheers

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi Yes! Great explanation. My complicated expression is generated by Mathematica, I have checked with and it works well using the method you provided. By the way , may I make a link of your answer to my question on Stack Overflow so people like me as a greenhorn can learn from it. I didn't respect such a great answer, thanks a lot.

Cheers

szaghi commented 7 years ago

Dear @ComplicatedPhenomenon

I am happy this had helped you, feel free to link whatever of my poor examples.

Happy Fortran!

Cheers

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi I manually installed FoBis.py, Before installation, I make sure requirements is satisfied. Then I run FoBiS.py , error occurs

    Traceback (most recent call last):
     File "/usr/local/bin/FoBiS.py", line 4, in <module>
        __import__('pkg_resources').run_script('FoBiS.py==2.2.2', 'FoBiS.py')
       File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 738, in run_script
        self.require(requires)[0].run_script(script_name, ns)
       File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1491, in run_script
       raise ResolutionError("No script named %r" % script_name)
       pkg_resources.ResolutionError: No script named 'FoBiS.py'

I can't figure out what I've done wrong, would you help me fix it ? Thank you.

Best Wishes!

szaghi commented 7 years ago

@ComplicatedPhenomenon

Sure, I think I can help. However, I have to ask you to wait for some hours, I am very busy now.

See you later!

szaghi commented 7 years ago

@ComplicatedPhenomenon

Ok, I have now few time (later tomorrow much more). Can you provide me some more details about how you install FoBiS? Have you followed this instructions? It has been passed some time till the last one I tested the manual installation (why not pip?) thus I can have break the manual installation at some point...

ComplicatedPhenomenon commented 7 years ago

Dear@szaghi The steps of my installation as follows:

git clone https://github.com/szaghi/FoBiS
cd release/FoBiS-master  
python setup.py install

I don't do it by pip, because I learn little when the installation is automatically completed. that's not good for a beginner I think.

My best regards!

ComplicatedPhenomenon commented 7 years ago

@szaghi I did install MaTiSSe.py through sudo pip install MaTiSSe.py, similar errors occur

Traceback (most recent call last):
  File "/usr/local/bin/MaTiSSe.py", line 5, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/matisse/matisse.py", line 161, in main
    make_presentation(config=config, source=source, output=output)
  File "/usr/local/lib/python2.7/dist-packages/matisse/matisse.py", line 114, in make_presentation
    presentation.parse(config=config, source=source)
  File "/usr/local/lib/python2.7/dist-packages/matisse/presentation.py", line 297, in parse
    self.__check_bad_sectioning(tokens=tokens)
  File "/usr/local/lib/python2.7/dist-packages/matisse/presentation.py", line 152, in __check_bad_sectioning
    if '$titlepage' not in tokens['slides'][0]['match'].group().lower():
IndexError: list index out of range
szaghi commented 7 years ago

Dear @ComplicatedPhenomenon

The steps of my installation as follows...

mmm, there is something odd here. I have just replicated your steps on a fresh-clean virtual env ad the manually installation seems to work, see the following

┌╼ stefano@zaghi(05:25 PM Thu Jun 08)
├───╼ ~/downloads 31 files, 261Mb
└──────╼ mkdir comply

┌╼ stefano@zaghi(05:25 PM Thu Jun 08)
├───╼ ~/downloads 32 files, 261Mb
└──────╼ cd comply/

┌╼ stefano@zaghi(05:26 PM Thu Jun 08)
├───╼ ~/downloads/comply 0 files, 28Kb
└──────╼ virtualenv -p /usr/bin/python2.7 venv
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/stefano/downloads/comply/venv/bin/python2.7
Also creating executable in /home/stefano/downloads/comply/venv/bin/python
Installing setuptools, pip, wheel...done.

┌╼ stefano@zaghi(05:26 PM Thu Jun 08)
├───╼ ~/downloads/comply 1 files, 32Kb
└──────╼ source venv/bin/activate

┌╼ stefano@zaghi(05:27 PM Thu Jun 08) pvenv {venv}
├───╼ ~/downloads/comply 1 files, 32Kb
└──────╼ git clone https://github.com/szaghi/FoBiS
Cloning into 'FoBiS'...
remote: Counting objects: 2650, done.
remote: Total 2650 (delta 0), reused 0 (delta 0), pack-reused 2650
Receiving objects: 100% (2650/2650), 15.37 MiB | 6.40 MiB/s, done.
Resolving deltas: 100% (1321/1321), done.

┌╼ stefano@zaghi(05:27 PM Thu Jun 08) pvenv {venv}
├───╼ ~/downloads/comply 2 files, 36Kb
└──────╼ cd FoBiS/release/FoBiS-master/

┌╼ stefano@zaghi(05:27 PM Thu Jun 08) on master pvenv {venv}
├───╼ ~/downloads/comply/FoBiS/release/FoBiS-master 10 files, 84Kb
└──────╼ python setup.py install
running install
running bdist_egg
running egg_info
creating FoBiS.py.egg-info
writing requirements to FoBiS.py.egg-info/requires.txt
writing FoBiS.py.egg-info/PKG-INFO
writing top-level names to FoBiS.py.egg-info/top_level.txt
writing dependency_links to FoBiS.py.egg-info/dependency_links.txt
writing entry points to FoBiS.py.egg-info/entry_points.txt
writing manifest file 'FoBiS.py.egg-info/SOURCES.txt'
reading manifest file 'FoBiS.py.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'FoBiS.py.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/fobis
copying fobis/Gcov.py -> build/lib/fobis
copying fobis/Compiler.py -> build/lib/fobis
copying fobis/cli_parser.py -> build/lib/fobis
copying fobis/FoBiSConfig.py -> build/lib/fobis
copying fobis/Builder.py -> build/lib/fobis
copying fobis/Colors.py -> build/lib/fobis
copying fobis/fobis.py -> build/lib/fobis
copying fobis/__init__.py -> build/lib/fobis
copying fobis/utils.py -> build/lib/fobis
copying fobis/Doctest.py -> build/lib/fobis
copying fobis/Fobos.py -> build/lib/fobis
copying fobis/ParsedFile.py -> build/lib/fobis
copying fobis/Cleaner.py -> build/lib/fobis
copying fobis/Dependency.py -> build/lib/fobis
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Gcov.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Compiler.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/cli_parser.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/FoBiSConfig.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Builder.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Colors.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/fobis.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/__init__.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/utils.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Doctest.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Fobos.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/ParsedFile.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Cleaner.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib/fobis/Dependency.py -> build/bdist.linux-x86_64/egg/fobis
byte-compiling build/bdist.linux-x86_64/egg/fobis/Gcov.py to Gcov.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Compiler.py to Compiler.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/cli_parser.py to cli_parser.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/FoBiSConfig.py to FoBiSConfig.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Builder.py to Builder.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Colors.py to Colors.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/fobis.py to fobis.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Doctest.py to Doctest.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Fobos.py to Fobos.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/ParsedFile.py to ParsedFile.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Cleaner.py to Cleaner.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Dependency.py to Dependency.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/scripts-2.7
copying and adjusting FoBiS.py -> build/scripts-2.7
changing mode of build/scripts-2.7/FoBiS.py from 644 to 755
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/FoBiS.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/FoBiS.py to 755
copying FoBiS.py.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/FoBiS.py-2.2.2-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing FoBiS.py-2.2.2-py2.7.egg
Copying FoBiS.py-2.2.2-py2.7.egg to /home/stefano/downloads/comply/venv/lib/python2.7/site-packages
Adding FoBiS.py 2.2.2 to easy-install.pth file
Installing FoBiS.py script to /home/stefano/downloads/comply/venv/bin

Installed /home/stefano/downloads/comply/venv/lib/python2.7/site-packages/FoBiS.py-2.2.2-py2.7.egg
Processing dependencies for FoBiS.py==2.2.2
Finished processing dependencies for FoBiS.py==2.2.2

┌╼ stefano@zaghi(05:27 PM Thu Jun 08) on master [?] pvenv {venv}
├───╼ ~/downloads/comply/FoBiS/release/FoBiS-master 13 files, 96Kb
└──────╼ cd -

┌╼ stefano@zaghi(05:28 PM Thu Jun 08) pvenv {venv}
├───╼ ~/downloads/comply 2 files, 36Kb
└──────╼ which FoBiS.py
/home/stefano/downloads/comply/venv/bin/FoBiS.py

┌╼ stefano@zaghi(05:28 PM Thu Jun 08) pvenv {venv}
├───╼ ~/downloads/comply 2 files, 36Kb
└──────╼ cp -r ~/fortran/PENF/ .

┌╼ stefano@zaghi(05:28 PM Thu Jun 08) pvenv {venv}
├───╼ ~/downloads/comply 3 files, 40Kb
└──────╼ cd PENF/

┌╼ stefano@zaghi(05:28 PM Thu Jun 08) on master pvenv {venv}
├───╼ ~/downloads/comply/PENF 14 files, 120Kb
└──────╼ FoBiS.py build
Module 'pygooglechart' not found: Gcov graphs disabled
Builder options
  Directories
    Building directory: "shared"
    Compiled-objects .o   directory: "shared/obj"
    Compiled-objects .mod directory: "shared/mod"
  Compiler options
    Vendor: "gnu"
    Compiler command: "gfortran"
    Module directory switch: "-J"
    Compiling flags: "-cpp -c -fPIC -frealloc-lhs -O2"
    Linking flags: "-shared -O2"
    Preprocessing flags: ""
    Coverage: False
    Profile: False
  Preprocessor used: None
  Preprocessor output directory: None
  Preprocessor extensions processed: []

Building src/lib/penf.F90
Compiling src/lib/penf_global_parameters_variables.F90 serially
Compiling src/lib/penf_b_size.F90 serially
Compiling src/lib/penf_stringify.F90 serially
Compiling src/lib/penf.F90 serially
Linking shared/penf.so
Target src/lib/penf.F90 has been successfully built

Note that in the fresh installation I made I used a clean virtual env: as the which command show I am using the fresh installed FoBiS rather than the system one. With it I successfully compiled one of my fortran project, thus I can conclude that the install steps have followed are right. As a consequence, I have to think that the difference is in our system: I am using Python 2.7 on an a Arch Linux 4.11.3-1 x86_64. Which are your Python version and OS details?

Concerning the issue related to MaTiSSe the errors you shown seem to refer to a different problem: it seems that a bad formatted input file has been passed to it, e.g.

  File "/usr/local/lib/python2.7/dist-packages/matisse/presentation.py", line 152, in __check_bad_sectioning
    if '$titlepage' not in tokens['slides'][0]['match'].group().lower():
IndexError: list index out of range

Please, let me know exactly how you run FoBiS.py/MaTiSSe.py and their inputs, not only the last lines of the traceback.

Thank you for your feedback,

Cheers.

ComplicatedPhenomenon commented 7 years ago

Dear @szaghi Python version and OS details

wm@MARVEL:~/playground/example$ uname -a
Linux MARVEL 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
wm@MARVEL:~/playground/example$ python -V
Python 2.7.12
wm@MARVEL:~/playground/example/FoBiS/release/FoBiS-master$ sudo -H python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to FoBiS.py.egg-info/requires.txt
writing FoBiS.py.egg-info/PKG-INFO
writing top-level names to FoBiS.py.egg-info/top_level.txt
writing dependency_links to FoBiS.py.egg-info/dependency_links.txt
writing entry points to FoBiS.py.egg-info/entry_points.txt
reading manifest file 'FoBiS.py.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'FoBiS.py.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/FoBiSConfig.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Cleaner.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Gcov.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/__init__.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/cli_parser.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/fobis.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Compiler.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/ParsedFile.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Fobos.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/utils.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Colors.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Builder.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Doctest.py -> build/bdist.linux-x86_64/egg/fobis
copying build/lib.linux-x86_64-2.7/fobis/Dependency.py -> build/bdist.linux-x86_64/egg/fobis
byte-compiling build/bdist.linux-x86_64/egg/fobis/FoBiSConfig.py to FoBiSConfig.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Cleaner.py to Cleaner.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Gcov.py to Gcov.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/cli_parser.py to cli_parser.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/fobis.py to fobis.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Compiler.py to Compiler.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/ParsedFile.py to ParsedFile.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Fobos.py to Fobos.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/utils.py to utils.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Colors.py to Colors.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Builder.py to Builder.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Doctest.py to Doctest.pyc
byte-compiling build/bdist.linux-x86_64/egg/fobis/Dependency.py to Dependency.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/FoBiS.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/FoBiS.py to 755
copying FoBiS.py.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying FoBiS.py.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/FoBiS.py-2.2.2-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing FoBiS.py-2.2.2-py2.7.egg
Removing /usr/local/lib/python2.7/dist-packages/FoBiS.py-2.2.2-py2.7.egg
Copying FoBiS.py-2.2.2-py2.7.egg to /usr/local/lib/python2.7/dist-packages
FoBiS.py 2.2.2 is already the active version in easy-install.pth
Installing FoBiS.py script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/FoBiS.py-2.2.2-py2.7.egg
Processing dependencies for FoBiS.py==2.2.2
Finished processing dependencies for FoBiS.py==2.2.2

wm@MARVEL:~/playground/example$ which FoBiS.py 
/usr/local/bin/FoBiS.py

wm@MARVEL:~/playground/example/test$ FoBiS.py build
Traceback (most recent call last):
  File "/usr/local/bin/FoBiS.py", line 4, in <module>
    __import__('pkg_resources').run_script('FoBiS.py==2.2.2', 'FoBiS.py')
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 738, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1491, in run_script
    raise ResolutionError("No script named %r" % script_name)
pkg_resources.ResolutionError: No script named 'FoBiS.py'

I guess it might because I installed it unsuccessfully long before, so even though I follow the right instructions, there is still conflictions behind. Then I uninstalled it sudo -H pip uninstall FoBiS.py and installed it aginit again and it worked

wm@MARVEL:~/playground/example/test$ FoBiS.py build
Building ./CT14Pdf.for
Compiling ./CT14Pdf.for serially
Warning: compiling file ./CT14Pdf.for fails! Removing from the list of non-module libraries linked into the target!
Builder options
  Directories
    Building directory: "."
    Compiled-objects .o   directory: "obj"
    Compiled-objects .mod directory: "mod"
  Compiler options
    Vendor: "intel"
    Compiler command: "ifort"
    Module directory switch: "-module"
    Compiling flags: "-c"
    Linking flags: ""
    Preprocessing flags: ""
    Coverage: False
    Profile: False
  Preprocessor used: None
  Preprocessor output directory: None
  Preprocessor extensions processed: []

Building ./MAIN.f90
Compiling ./FXN.f90 ./MC_VEGAS.f90 serially
/bin/sh: 1: ifort: not found

/bin/sh: 1: ifort: not found

/bin/sh: 1: ifort: not found
/bin/sh: 1: ifort: not found

Thanks for your time and patience.

Cheers.

szaghi commented 7 years ago

@ComplicatedPhenomenon

Nope, thank you too! Your feedback is very interesting: so a failing installing can cause successive conflicts... this is a note that I have to keep!

Aside, I just see that the default behavior of FoBiS is to try to use Intel Fortran: in the next release I will change it making GNU the default one.

Cheers