fortran66のブログ

fortran について書きます。

【メモ帳】Internet Archive 図書館より

Metcalf, Reid 本

Metcalf, Fortran Optimization

第 12 章 Future Fortran に、初期の Fortran 8x 構想の紹介あり(コア言語+過去互換モジュール+拡張モジュール)。
archive.org

Metcalf & Reid, Fortran 8x Explained (1987)

Fortran 8x Explained には 1987 年版と 1989 年版があるが、これは 1987 年版。1987 年版には parameterized derived type があるが、1989 年版には無い。1989 年版の方が細かな部分が増えて厚い。
archive.org

【寝言】支那通キッシンジャーw

支那キッシンジャー

この前キッシンジャーの悪口を書いたら、丁度同じころワシントンポスト支那人キッシンジャーに頼んだのにトランプ政権からガン無視されたという記事が出ていたようです。時差を考えるとほぼ同時?シンクロニシティ―w
fortran66.hatenablog.com

www.washingtonpost.com

“The Chinese felt that they could maybe control this Trump guy a bit using Henry Kissinger, Steve Schwarzman, Hank Paulson and so forth, but China has realized they don’t have near as much influence over Trump as they anticipated,” said Max Baucus, ambassador to Beijing during the Obama administration.

In September, Wang, the Renmin University scholar, and a Chinese delegation met with Kissinger in New York and asked the 95-year-old former secretary of state to deliver a message to the White House. Kissinger tried to temper expectations: The Chinese may hold him in high esteem, Kissinger said, but Trump probably wouldn’t listen.

ネタ元
youtu.be

そろそろある人がニクソン政権の頃、キリスト教的にありえない服装でいたいけな美少年と第三種接近遭遇をしたとか、ドイツ時代に動物に対してある種の特殊な愛のスキンシップをしていたとか、そんな感じの楽しいニュースが出てくるんじゃないかとワクワク期待に胸がふくらみます。生きているうちに、生前の業績を全否定されて、ショタホモペドケモナーとして死んでゆくのが見たい!

支那富坂聰

気の狂ったような記事を書いています。意味が分かりません。
www.zakzak.co.jp

安倍首相は、李克強習近平の権力争いの火に、うまい具合に油を注いできたと思います。近平の唱えた「一帯一路」という用語を完全無視してた辺りが、仲間割れの疑心暗鬼を高めさせます。

帰国直後に、インドのモディ首相と親しくして、ドルスワップ協定で、対中国の円スワップの二倍の金額を提示して、見事にあてこすりました。

ひと月くらい前、最近の中国は、大気汚染を解決して青空が広がっているとかいう、まことに胡散臭いニュースがありましたが、安倍首相へ青空を出さない嫌がらせをすることで、逆に普段は全然大気汚染対策が進んでいないことも露呈しました。この辺の間抜けぶりが支那人らしくていいと思います。支那の五人兄弟よろしく汚染された海の水や空気を飲み込んで欲しいものです。

jbpress.ismedia.jp

シナの五にんきょうだい

シナの五にんきょうだい

在華紡の問題

いまでは軍部が悪いとされていますが、戦前の支那においては、財界が支那に進出した自分らの紡績工場などを守るため渋る軍部に無理やり支那へ兵力を割かせ、朝日新聞や日日新聞などが散々大衆を煽って時局収束を図る軍部を追い詰め事変を拡大させています。

今日、またしても無責任な財界と愚劣な新聞などが、支那撤退を妨げていますが、戦前の在華紡問題の二の舞だと思います。我が国は支那朝鮮とは関わらず、イギリスの対ナポレオン海上封鎖よろしく、兵糧攻めして我関せず、我等に天竺ありとして、己は産業革命に邁進するのが吉と思います。

【寝言】Modern Fortran Explained 2018 来た

MFE 届く

f:id:fortran66:20181101014012p:plain
90 以前は古本買い。F も古本。Modern Fortran は、F ではなく Lahey の Esseential Fortran 90 (ELF90) の方を付属の紙マニュアルで勉強をしたが、ELF90 の処理系は古い命令が削られているので、77 からの移行勉強に丁度良かった。

90/95 の頃はコンパイラ付属の紙マニュアルがあったので、90/95 本はあまり読まなかった。その後マニュアルは PDF に移行したので、字引き的に使う分には便利だが通して読むのはつらくなった。95/2003 は新しいことが多くて、よく読んだので、背が割れてしまった。MFE(緑)は背割れしないように大事に読んでいたが、お茶をこぼしてしまって憤死。

MFE 2018(赤)は今までよりももっと分厚くなると思って、背割れしないようにハードカバーを買ってみたが、それほど厚くならなかった。とにかく値段が高くて憤死。『俺がお嬢様学校に「庶民サンプル」としてゲッツされた件 マストゲッツ!Blu-ray BOX』よりも高い・・・

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)


邪神ちゃんの Blu-Ray を諦めることにして、Numrich の coarray 本も買うことにしたw

Parallel Programming with Co-arrays (Chapman & Hall/CRC Computational Science)

Parallel Programming with Co-arrays (Chapman & Hall/CRC Computational Science)

ZMQ を利用して Fortran で http server

ZMQ zmq-socket

ZMQ の zmq-socket 関数のサンプルに、http server の例題があったので、真似して Fortran で書いて見ました。

zmq_socket(3) - 0MQ Api

ZeroMQ: Messaging for Many Applications

ZeroMQ: Messaging for Many Applications

ZeroMQ

ZeroMQ

実行例

f:id:fortran66:20181031002555p:plain

ソース・プログラム

成り行きでいじっていたので、examples ディレクトリに作ってしまいましたw

O@HP8:~/f77_zmq-master/examples$ gfortran -g -O2 -Wall -Wno-unused -fopenmp test.f ../travis_ci/lib/libzmq.so libf77zmq.a -lzmq

include file のために、固定形式にしたので 72 桁制限があります。

      program server
        implicit none
        include 'f77_zmq.h'
        integer(ZMQ_PTR) :: context
        integer(ZMQ_PTR) :: socket
        character(len = :), allocatable :: id, raw, http_response
        integer :: rc, id_size, iraw_size
        character(len = *), parameter :: CRLF = achar(13) // achar(10)

        allocate (character(len = 256):: id, raw)
        http_response = 'HTTP/1.0 200 OK'    // CRLF //
     &                  'Content-Type: text/html' // CRLF //
     &                                                CRLF //
     &    '<!DOCTYPE html>'                        // CRLF //
     &    '<html>'                                 // CRLF //
     &    '<head>'                                 // CRLF //
     &    '<title>Fortran ZMQ http server</title>' // CRLF //
     &    '</head>'                                // CRLF //
     &    '<body>'                                 // CRLF //
     &    '<h1>Fortran ZMQ http server </h1>'      // CRLF //
     &    '<p>Make Fortran Great Again!</p>'       // CRLF //
     &    '</body>'                                // CRLF //
     &    '</html>'

        context   = f77_zmq_ctx_new()
        socket    = f77_zmq_socket(context, ZMQ_STREAM)
        rc        = f77_zmq_bind(socket, 'tcp://*:8080')
        if (rc /= 0) stop 'Initialization error!'

        do
          id_size = f77_zmq_recv(socket, id, 256, 0)
          if (id_size <= 0) stop 'id_size error!'
          do
            iraw_size = f77_zmq_recv(socket, raw, 256, 0)
            if (iraw_size < 0) stop 'raw_size error!'
            if (iraw_size == 256) cycle
            exit
          end do
          rc = f77_zmq_send(socket, id, id_size, ZMQ_SNDMORE)
          rc = f77_zmq_send(socket, http_response,
     &                                  len(http_response), 0)
          rc = f77_zmq_send (socket, id, id_size, ZMQ_SNDMORE)
          rc = f77_zmq_send (socket, 0, 0, 0)
        end do

        rc = f77_zmq_close(socket)
        rc = f77_zmq_ctx_destroy(context)
      end program server

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Parallel Programming with Co-arrays (Chapman & Hall/CRC Computational Science)

Parallel Programming with Co-arrays (Chapman & Hall/CRC Computational Science)

Modern Missile Guidance

Modern Missile Guidance

【ニュース】Modern Fortran Explained: Incorporating Fortran 2018 出荷!

MFE2018

目次を見る限り、50頁くらいしか増えていないようです。

F03 で拡張された機能について色々細かな説明をしていたところをバッサリ切ってきた模様です。
15 章 Establishing and moving data, 16 章 Miscellaneous enhancements, 17 章 Input/output enhancements の章が無くなって、各所に吸収されたようです。代わりに 2018 関係の新機能の章が入りました。

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

【メモ帳】Fortran ZMQ でネット接続

f77_mzq

f77 での ZMQ binding があるようです。f77 風になっているので、include で定数などを読み込んでいます。結構、python を使って自動でインターフェース情報を生成しています。
github.com

travis_ci 下の install_zmq.sh および test_build.sh で examples 下の例題が実行されます。WSL で問題なく動きました。

調子に乗って無理やり 8080 番で入力待ちして、ブラウザをつなげると、ブラウザ情報を取ることは出来ましたが、CZMQ のより高次の API が無いと、HTTP サーバーごっこは難しいようです。
よくマニュアルを見たら、サンプルがあって出来ましたw
fortran66.hatenablog.com


ガイドブックの日本語訳がありましたが、ネットワーク知識が無いので、わけわかめです。
www.cuspy.org

ZeroMQ: Messaging for Many Applications

ZeroMQ: Messaging for Many Applications

ZeroMQ

ZeroMQ

【メモ帳】色々

coarray 本 20%off

Robert W. Numrich 氏の coarray 本は出版社から直接買うと二割引きの模様です。送料無料。
https://www.crcpress.com/assets/images/crc/oct-2018-sale.png

www.crcpress.com

エクセルソフト・ウェビナー

インテルコンパイラツールのウェビナーが見られます。
www.youtube.com

OpenMP 関係のウェビナーがあります。OpenMP もモリモリ肥大化しています。

参考:ヨーロッパにおける HPC ソフトウェア近況(2018-1)

www.nag.co.uk

グレース・ホッパー海軍大尉

COBOL の発明者として知られる グレース・ホッパー女史ですが、初期のコンピュータについての講演がプレヴューで読めます。強烈な人柄がにじみ出ています。
海軍で最初期からコンピュータ・プログラム開発に携わっていて、バッカスとは別の視点でプログラム言語の誕生を語っていて興味深いです。

米空軍

関係ないですが、アメリカ空軍も独自のコンピュータ利用を模索していて、ALGOL (IAL) に基づく独自の JOVIAL 言語の開発につながったようです。そのことがのちの PASCAL 系の ADA の採用に影響しているようです。