Bakul Shah wrote a particularly elegant Scheme program for Chudnovskys'
algorithm for pi based on the Common Lisp program here:
https://bitbucket.org/tarballs_are_good/numericl/src/5fe8fe7089f48ab1c8a388…
Nick Craig-Wood wrote a Python program using the GMP multiprecision
library that appears to use exactly the same algorithm here:
http://www.craig-wood.com/nick/articles/pi-chudnovsky/
I modified both programs a bit and include them here.
They time the calculation of $10^n$ digits of pi for $n=1,2,3,4,5,6,7$.
The results are
heine:~/programs/gambiteer/gambit> !py
python pi_chudnovsky_bs_gmpy.py
31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
('chudnovsky_gmpy_mpz_bs: digits', 10, 'time', 1.0967254638671875e-05)
('chudnovsky_gmpy_mpz_bs: digits', 100, 'time', 3.0040740966796875e-05)
Last 5 digits 70679 OK
('chudnovsky_gmpy_mpz_bs: digits', 1000, 'time', 0.00025582313537597656)
Last 5 digits 01989 OK
('chudnovsky_gmpy_mpz_bs: digits', 10000, 'time', 0.00386810302734375)
Last 5 digits 75678 OK
('chudnovsky_gmpy_mpz_bs: digits', 100000, 'time', 0.0834801197052002)
Last 5 digits 24646 OK
('chudnovsky_gmpy_mpz_bs: digits', 1000000, 'time', 1.655979871749878)
Last 5 digits 58151 OK
('chudnovsky_gmpy_mpz_bs: digits', 10000000, 'time', 30.67442488670349)
Last 5 digits 55897 OK
heine:~/programs/gambiteer/gambit> gsi chud1.scm
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
10, CPU time: 0..
Last 5 digits 26535.
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
100, CPU time: 0..
Last 5 digits 70679.
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
1000, CPU time: .004.
Last 5 digits 1989.
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
10000, CPU time: .028.
Last 5 digits 75678.
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
100000, CPU time: .472.
Last 5 digits 24646.
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
1000000, CPU time: 6.448.
Last 5 digits 58151.
Chudnovsky's algorithm using binary splitting in Gambit Scheme: digits
10000000, CPU time: 98.612.
Last 5 digits 55897.
So it appears that for this algorithm applied to large integers, GMP's
bignum routines are about 3-4 times as fast as Gambit's bignum
routines. Not so bad. For smaller bignums, GMP has a bigger advantage.
The C program gmp-chudnovsky.c includes certain optimizations to this
basic algorithm:
http://gmplib.org/pi-with-gmp.htmlftp://ftp.gmplib.org/pub/misc/gmp-chudnovsky.c
On my machine, compiled with
gcc -O3 -march=native -o gmp-chudnovsky gmp-chudnovsky.c -lgmp -lm
the CPU times for 1,000,000 and 10,000,000 digits are 1.064 and 18.200
seconds, respectively.
This is with a somewhat older machine
model name : Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
running Ubuntu 13.04 with
heine:~/programs/gambiteer/gambit> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --with-system-zlib
--enable-objc-gc --with-cloog --enable-cloog-backend=ppl
--disable-cloog-version-check --disable-ppl-version-check
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
heine:~/programs/gambiteer/gambit> gsi -v
v4.6.9 20130607151908 x86_64-unknown-linux-gnu "./configure
'--enable-single-host' '--enable-multiple-versions' '--enable-shared'"
and the Ubuntu-provided GMP 5.0.5. (I'm sure the GMP folks have a
better way to build GMP on my machine than the "generic" 64-bit version
provided by Ubuntu.)
Brad
I compared the run time of the test program of SRFI 231, an array SRFI:
https://srfi.schemers.org/srfi-231/
by upping the number of samples in each random test to 10,000 by setting random-tests to 10000 in
https://github.com/scheme-requests-for-implementation/srfi-231/blob/master/…
I used the same version of Gambit and gcc on all machines:
lucier% gsi -v
v4.9.4-26-g015c8875 20220323161655 x86_64-apple-darwin20.6.0 "./configure 'CC=/usr/local/gcc-11.2.0/bin/gcc' '--enable-march=native' '--enable-dynamic-clib' '--enable-single-host' '--enable-multiple-versions' '--enable-shared’”
The results:
Dell Workstation running Ubuntu 20.04
model name : Intel(R) Xeon(R) CPU E3-1271 v3 @ 3.60GHz
144.279u 0.443s 2:25.12 99.7% 0+0k 8+1024io 0pf+0w
32GB RAM
Model Identifier: MacBookPro18,4
Chip: Apple M1 Max
Up to 3.228 GHz
64GB RAM
69.523u 0.324s 1:10.25 99.4% 0+0k 0+0io 0pf+0w
Model Identifier: Macmini8,1
Processor Name: 6-Core Intel Core i7
Processor Speed: 3.2 GHz
Intel Core i7-8700B @ 3.2 GHz
107.773u 0.255s 1:48.65 99.4% 0+0k 0+0io 0pf+0w
So running this, the Mac mini is significantly faster than the Linux box, but the Linux box feels faster for nearly all development.
I’m quite pleased with the MacBook Pro, though.
Brad
The 2022 Scheme and Functional Programming Workshop is calling for submissions.
We invite high-quality papers and talk proposals about novel research results, lessons learned from practical experience in an industrial or educational setting, and even new insights on old ideas. We welcome and encourage submissions that apply to any dynamic functional language, especially those that can be considered a Scheme: from strict subsets of RnRS to other "Scheme" implementations, to Racket, to Lisp dialects including Clojure, Emacs Lisp, Common Lisp, to functional languages with continuations and/or macros (or extended to have them) such as Dylan, ECMAScript, Hop, Lua, Scala, Rust, etc. The elegance of the paper and the relevance of its topic to the interests of Schemers will matter more than the surface syntax of the examples used.
Topics
Topics of interest include (but are not limited to):
Interaction: program-development environments, debugging, testing, refactoring
Implementation: interpreters, compilers, tools, garbage collectors, benchmarks
Extension: macros, hygiene, domain-specific languages, reflection, and how such extension affects interaction
Expression: control, modularity, ad hoc and parametric polymorphism, types, aspects, ownership models, concurrency, distribution, parallelism, non-determinism, probabilism, and other programming paradigms
Integration: build tools, deployment, interoperation with other languages and systems
Formal semantics: theory, analyses and transformations, partial evaluation
Human factors: past, present and future history, evolution and sociology of the language Scheme, its standard and its dialects
Education: approaches, experiences, curricula
Applications: industrial uses of Scheme
Scheme pearls: elegant, instructive uses of Scheme
Dates
Submission deadline is 2022-07-22.
Authors will be notified by 2022-08-15.
Camera-ready versions are due 2022-09-02.
Workshop will be held in Ljubljana, Slovenia on 2022-09-16.
All deadlines are 23:59 UTC-12, anywhere on Earth.
Submission Information
We encourage all kinds of submissions, including full papers, experience reports, and lightning talks. Papers and experience reports are expected to be 10–24 pages in length using the single-column SIGPLAN acmart style. (For reference, this is about 5–12 pages of the older SIGPLAN 2-column 9pt style.) Abstracts submitted for lightning talks should be limited to 192 words.
Authors of each accepted submission are invited to attend and be available for the presentation of that paper at the conference. The schedule for presentations will be determined and shared with authors after the full program has been selected.
The size limits above exclude references and any optional appendices. There are no size limits on appendices, but the papers should stand without the need to read them, and reviewers are not required to read them.
Authors are encouraged to publish any code associated to their papers under an open source license, so that reviewers may try the code and verify the claims.
Proceedings will be uploaded to arXiv.org <https://arxiv.org/>.
Publication of a paper at this workshop is not intended to replace conference or journal publication, and does not preclude re-publication of a more complete or finished version of the paper at some later conference or in a journal.
Please submit papers through the workshop's HotCRP site <https://scheme2022.hotcrp.com/>.
Lightweight double-blind reviewing
Scheme 2022 will use lightweight double-blind reviewing. Submitted papers must omit author names and institutions and reference the authors’ own related work in the third person (e.g., not “we build on our previous work…” but rather “we build on the work of…”).
The purpose is to help the reviewers come to an initial judgment about the paper without bias, not to make it impossible for them to discover the authors if they were to try. Nothing should be done in the name of anonymity that weakens the submission or makes the job of reviewing the paper more difficult (e.g., important background references should not be omitted or anonymized).
Formatting Information
Full papers and experience reports should use the SIGPLAN acmsmall option to acmart. We recommend using the anonymous and review options to acmart when submitting a paper; these options hide the author names and enable line numbers for easy reference in review. LaTeX and Microsoft Word templates for this format are available through SIGPLAN <https://www.sigplan.org/Resources/Author/>.
Lightning talks can be submitted as either a text file or a PDF file.
International Conference on Functional Programming
The Scheme Workshop 2022 is being held as part of this year's International Conference on Functional Programming. Here is the ICFP site <https://icfp22.sigplan.org/home/scheme-2022> for the workshop.
Sincerely,
Andy Keep, General Co-chair
Arthur A. Gleckler, General Co-chair
-------------------------------------------------------------------------------
C A L L F O R P A R T I C I P A T I O N
11th International Workshop on Trends in Functional Programming in
Education
+
23rd Symposium on Trends in Functional Programming
16 - 18 March 2022
wiki.tfpie.science.ru.nl/TFPIE2022
trendsfp.github.io
-------------------------------------------------------------------------------
The programmes for TFPIE and TFP are online (all times are UTC+0):
- TFPIE: https://wiki.tfpie.science.ru.nl/TFPIE2022
- TFP: https://trendsfp.github.io/schedule.html
Registration is free. Prior to the events you receive a mail with the
links to
the Zoom meetings.
The Symposium on Trends in Functional Programming (TFP) is an international
forum for researchers with interests in all aspects of functional
programming,
taking a broad view of current and future trends in the area. We aspire
to be
a lively environment for presenting the latest research results, and other
contributions.
The Trends in Functional Programming in Education workshops are an
informal meeting
intended for researchers, professors, teachers, and all professionals
that use or
are interested in the use of functional programming in education. TFPIE
aims to be
a venue where novel ideas, classroom-tested ideas, and work in progress
on the use
of functional programming in education are discussed. We foster a spirit
of open
discussion by having a review process for publication after the workshop.
The program has a lot of interesting talks, possibilities for
interaction, and
keynote presentations:
Trends in Functional Programming in Education keynote speaker:
---------------------------------------------------------------
Peter Achten: The Perfect Functional Programming Course
Trends in Functional Programming keynote speaker:
-------------------------------------------------
Christiaan Baaij: Building a Haskell-to-Hardware compiler: Theory & Practice