Silverfrost Forums

Welcome to our forums

Fortran 2003/2008

29 Apr 2019 9:13 #23561

John, If you had to count to 9 billion, even US billions, you'd need an integer bigger than INTEGER4. Computers I used in the 60s used 24-bit words, and used 2 words for an INTEGER. They could hold 9 billion - even the UK 10^12 billion then in use. Two 24 bit words are effectively INTEGER6. In other words, the job was doable back then. INTEGER*8 is overkill for that job.

Incidentally, the program would probably print out the 9-character names on a 132 column line printer, say 12 or 13 on a line, once the algorithm had found that many names, so apart from keeping count, the storage requirements were tiny. Assuming that the Tibetan character set was implemented on the lineprinter., all the algorithm had to do was to permutate all combinations and reject those that didn't make sense - the story explains that in principle not in detail.

It couldn't have been done in Fortran in 1953, but only in assembly language, and so the absence of a CHARACTER type is of no consequence.

I'm not sure that the computers of 1953 (when the story was written) were up to the job - those of the mid to late 60s certainly were.

Eddie

30 May 2019 5:07 #23710

I have experimented with writing my own ISO_FORTRAN_ENV module and placed the .f90 .mod and .obj files in .../Silverfrost/FTN95../INCLUDE.

This appears to work ok, although I need different source for 32-bit and 64-bit ( could be fixed with /cpp)

My tests appear to indicate all that is needed is the .mod or .mod64 file. In my testing I don't appear to need the .obj file (which would be different for 32 and 64 bit). I hope this is correct.

I have added a few 'extension' system routines, which could be a way of easily including them via USE ISO_FORTRAN_ENV, eg elapse_second and SIZEOF. I have an adaptation of Get_Compiler_Version, but not Compiler_Options ( which I solve by defining an environment variable in make.bat : SET OPTIONS=.... My generic version SIZEOF also works ! Others could be easily included.

see the link below for first draft.

Comments welcomed and this may be the start of a solution.

John

https://www.dropbox.com/s/zupns8q60hdg39t/iso_fortran_env.f90?dl=0

1 Jun 2019 4:19 #23715

For my ISO_FORTRAN_ENV .mod / .mod64 file, the compiling with USE ISO_FORTRAN_ENV appears to be ok, but linking is a problem.

It appears that I can't have contained routines, as this would require a .obj file. So my inclusion of Compiler_Version or Compiler_Options is not easy.

I also defined a generic INTERFACE for SIZEOF which appeared to work, but again the .obj component may also be required.

As for providing a /32 >.mod and /64 > .mod64, they would both require different .obj files which may require creating different named .lib files to be copied into .../Silverfrost/FTN95.. and referenced explicitly when using slink / slink64.

Still a possibility ??

3 Jun 2019 8:42 #23717

Paul,

Re: testing my iso_fortran_env module

I have got somewhere, as the linked example appears to work for 32-bit, but not for 64-bit. If successful, the approach I am using does not require changes to FTN95 or possibly SLINK/SLINK64

Apart from defining a number of constants eg INT64 and REAL64, it also has contained routines, which could be an easy way of introducing new extension functions.

The module contains functions which appear to run ok when called from dan_test.f90 (the program to test some features). Testing uses a number of routines from the module, including: get_compiler_version sizeof elapse_second report_available_memory get_available_memory Is_64_bit

The batch file 'do_dan_test.bat' indicates how I tested, although the copy needs to be done as administrator. I have only tested with this one .f90 file.

The main problem is if I try to do the test using /64, then the build does not work. I could not determine if there is a problem with the .obj file, or if it is needed for 32-bit.

Also the function Elapse_Second appears to work but not QueryPerformance_sec. This could relate to calling other routines defined in the .mod and what is in the .mod file. I turned off PRIVATE/PUBLIC to fix this but was not a fix.

Report_Available_Memory appears to work. It contains a lot of static data.

https://www.dropbox.com/s/dlba4hbiechxmse/iso_fortran_env_build.zip?dl=0

3 Jun 2019 9:11 #23718

John

Many thanks for your feedback. I have made a note of this for reference when we come to implement these features. At the moment I don't know whether we will be able to use your approach or take a different line.

Paul

Please login to reply.