浏览代码

Add Fortran.io framework (#7091)

* Add fortran framework

* Remove unused modules

* Remove JSON test

The framework doesn't provide a JSON serializer
jcox-techempower 3 年之前
父节点
当前提交
86c0b1367a

+ 15 - 0
frameworks/Fortran/fortran.io/README.md

@@ -0,0 +1,15 @@
+# Fortran.io Benchmarking Test
+
+### Test Type Implementation Source Code
+
+* [PLAINTEXT](src/fortran_fcgi.f90)
+
+## Important Libraries
+The tests were run with:
+* [Fortran.io](https://github.com/mapmeld/fortran-machine)
+
+## Test URLs
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext

+ 25 - 0
frameworks/Fortran/fortran.io/benchmark_config.json

@@ -0,0 +1,25 @@
+{
+  "framework": "fortran.io",
+  "tests": [
+    {
+      "default": {
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Fullstack",
+        "database": "None",
+        "framework": "Fortran.io",
+        "language": "Fortran",
+        "flavor": "None",
+        "orm": "None",
+        "platform": "None",
+        "webserver": "nginx",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "Fortran.io",
+        "notes": "",
+        "versus": "None"
+      }
+    }
+  ]
+}

+ 19 - 0
frameworks/Fortran/fortran.io/fortran.io.dockerfile

@@ -0,0 +1,19 @@
+FROM nginx:latest
+
+RUN apt-get -y update
+RUN apt-get -y upgrade
+RUN apt-get -y install gfortran git sqlite3 make libsqlite3-dev libfcgi-dev spawn-fcgi
+
+RUN git clone https://github.com/mapmeld/fortran-machine.git
+
+WORKDIR /fortran-machine
+COPY /src/fortran_fcgi.f90 fortran_fcgi.f90
+COPY nginx.conf /etc/nginx/nginx.conf
+COPY run.sh run.sh
+
+RUN make
+
+EXPOSE 8080
+
+CMD bash run.sh
+

+ 36 - 0
frameworks/Fortran/fortran.io/nginx.conf

@@ -0,0 +1,36 @@
+user  nginx;
+worker_processes  auto;
+
+error_log  /var/log/nginx/error.log notice;
+pid        /var/run/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile        on;
+    keepalive_timeout  65;
+
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        location / {
+            root /fortran-machine;
+            fastcgi_pass   127.0.0.1:9000;
+            fastcgi_keep_conn on;
+            include        fastcgi_params;
+        }
+    }
+}

+ 5 - 0
frameworks/Fortran/fortran.io/run.sh

@@ -0,0 +1,5 @@
+#!/bin/hash
+
+spawn-fcgi -a 127.0.0.1 -p 9000 ./fortran_fcgi
+
+nginx -g 'daemon off;'

+ 70 - 0
frameworks/Fortran/fortran.io/src/fortran_fcgi.f90

@@ -0,0 +1,70 @@
+!
+! Fortran FastCGI stack
+! Based on Fortran FastCGI by [email protected] and [email protected]
+!
+! Requires:
+!    - the FLIBS modules cgi_protocol and fcgi_protocol
+!    - the FastCGI library
+!
+
+program app
+
+    use fcgi_protocol
+
+    implicit none
+
+    type(DICT_STRUCT), pointer  :: dict => null() ! Initialisation is important!
+    logical                     :: stopped = .false. ! set to true in respond() to terminate program
+    integer                     :: unitNo ! unit number  for a scratch file
+    character(len=20)           :: mime = 'text/plain' ! mime type
+
+    ! open scratch file
+    open(newunit=unitNo, status='scratch')
+
+    ! wait for environment variables from webserver
+    do while (fcgip_accept_environment_variables() >= 0)
+
+        ! build dictionary from GET or POST data, environment variables
+        call fcgip_make_dictionary( dict, unitNo )
+
+        call respond(dict, unitNo, stopped, mime)
+
+        call fcgip_put_file( unitNo, mime )
+
+        ! terminate?
+        if (stopped) exit
+
+    end do !  while (fcgip_accept_environment_variables() >= 0)
+
+    close(unitNo)
+
+    ! webserver will return an error since this process will now terminate
+    unitNo = fcgip_accept_environment_variables()
+
+
+contains
+    subroutine respond ( dict, unitNo, stopped, mime )
+
+        type(DICT_STRUCT), pointer        :: dict
+        integer, intent(in)               :: unitNo
+        logical, intent(out)              :: stopped
+        character(len=20), intent(out)    :: mime
+
+        ! the script name
+        character(len=80)  :: scriptName, query
+
+        ! retrieve script name (key=DOCUMENT_URI) from dictionary
+        call cgi_get( dict, "DOCUMENT_URI", scriptName )
+
+        select case (trim(scriptName))
+            case ('/plaintext')
+                mime = 'text/plain'
+                write(unitNo, AFORMAT) 'Hello, World!'
+            case DEFAULT
+        end select
+
+        return
+
+    end subroutine respond
+
+end program app