Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create loopy test program for PL/I #311

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

markons
Copy link

@markons markons commented Dec 30, 2024

Add PL/I code identical to the COBOL pendant.

I have:

Description of changes

Directory PL1 added for the PL/I language.
The code on loopy.pl1 was tested under z/OS ADCD , PL/I Enterprise Edition V3.
ADCD run on a somewhate lame PC (Intel(R) Core(TM) i3-6100T CPU @ 3.20GHz ); the CPU time was 46MIN 59.65SEC.
An identical run on a "real" mainframe would be welcome.

Add PL/I code identical to the COBOL pendant.
@markons markons closed this Dec 30, 2024
@markons markons reopened this Dec 30, 2024
@markons
Copy link
Author

markons commented Dec 30, 2024

Reason for reopen: pull request was not merged.
@bddicken: Could you please review this pull request at your convenience? Thank you!

@PEZ
Copy link
Collaborator

PEZ commented Dec 30, 2024

Hello. Thanks for contributing! 🙏

However, if this program can't be run in a benchmark together with the other languages, it doesn't really belong, I think.

@markons
Copy link
Author

markons commented Dec 31, 2024

On which platform runs then the benchmark please?

@PEZ
Copy link
Collaborator

PEZ commented Dec 31, 2024

The benchmark runs on whatever computers people choose to run them on. For both @bddicken and me that means MacOS. But any environment that can run compile.sh and run.sh will do. If you add entries to those files for this program, we can start preparing to merge. I would also need instructions (or just a link) on how to install the toolchain. Please also consider providing a hello-world implementation, because we use that to measure start-times for the various languages.

@markons
Copy link
Author

markons commented Dec 31, 2024 via email

@PEZ
Copy link
Collaborator

PEZ commented Dec 31, 2024

Happy new year!

@markons
Copy link
Author

markons commented Jan 3, 2025

A little belatedly, I looked at compile.sh and was horrified.
Does this mean that on a given machine, all the compilers of the programming languages listed in the script must be installed?
I originally thought (wrongly, I guess) that the project was more or less a repository for benchmark programs.
Unfortunately, in PL/I's "native" environment (=mainframe) this is nearly impossible.
So I installed the Iron Spring PL/I compiler on the WSL Ubuntu under Windows, with Python for comparison.
But installing all languages is a Sisyphean task.
Would it be possible to install the Iron Spring compiler on a Unix machine where the other languages are already installed?

@PEZ
Copy link
Collaborator

PEZ commented Jan 3, 2025

Does this mean that on a given machine, all the compilers of the programming languages listed in the script must be installed?

Oh, no. I'm sorry that it created that impression! What I mean is that it needs to fit in this “framework”. So, if you have a way to compile and run it on Ubuntu that can be added to compile.sh and run.sh, that is totally OK. Please add those entries and we will have this PR merged. (And I repeat my wish for a hello-world contribution as well to be included.)

Now that you have given me hints on what I may need to install on my Mac, that is great too.

installing all languages is a Sisyphean task

Tell me about it. It has taken me a lot of time to get to here: https://pez.github.io/languages-visualizations/

Looking forward to be able to include PL/I!

This version was compiled and tested by the "official" compile and run scripts.
@markons
Copy link
Author

markons commented Jan 9, 2025 via email

@PEZ
Copy link
Collaborator

PEZ commented Jan 9, 2025

Hello again Gabor,

Awesome to see this! The performance is miles better than COBOL. 😄

You don't need to link the new code, btw, it is updated on this PR every time you push new code to the branch on your fork.

Three things:

  1. The naming of the program file. For all other languages the code is always in a <benchmark>/<language>/code.<extension> file. So for loops and C, this is loops/code.c. I don't even remember if file extensions are a thing on mainframes, but I imagine that loopy could be placed in loops/pl1/code.pl1, if .pl1 is some extension that could be used?
  2. Please update compile.sh and run.sh with the commands necessary to compile and run the program. Here it will get evident for you why the program should be named code.pl1, because the same commands would be used if someone (you?) contribute other benchmark implementations.
  3. Speaking about other benchmark implementations, I would very much like if you included an implementation of hello-world. We use this for measuring start times of each program.

As for instructions on how to install the toolchain. So far we have not had that, but I think it would be a good idea to include that somehow. How about we create a file hello-world/pl1/README.md where we say a few words about the language and also can link to the instructions on how to install the toolchain on a Unix machine? Then other languages can follow that model.

@markons
Copy link
Author

markons commented Jan 9, 2025 via email

@markons
Copy link
Author

markons commented Jan 9, 2025 via email

@markons
Copy link
Author

markons commented Jan 9, 2025 via email

@PEZ
Copy link
Collaborator

PEZ commented Jan 9, 2025

On the mainframes, there is no extension for program names. Still maximal 8 alphanumeric characters as for >50 years.*

😂

Thanks for updating! What we need for merging this PR is that compile.sh and run.sh are updated with the commands for compiling and running the PL1 benchmarks. Since both these scripts will be used for all PL1 programs, the commands need to be stripped of any references to loopy.

  • Do I need to create a "hello-world/pl1" subdirectory under my "PL1"

The hello-world program should go under hello-world/PL1/code.pli, where hello-world is a sibling directory to loops.

When you have moved the code there you should be able to cd to hello-world and run

../compile.sh

to compile the program(s), and:

../run.sh

to run them.

And from the loops directory you should be able to do the same for that program.

Depending on how many toolchains you have on your machine it can take a while to compile and run everything. Unfortunately the only way, so far, to run only one language is to comment out all the rest.

Here's a guess of what should go into compile.sh:

compile 'pl1' 'plic pl1/code.pli -o pl1/code.obj &&  ld -L/usr/lib32 --oformat=elf32-i386 -melf_i386 -z muldefs -Bstatic -e main -t -o pl1/code.exe pl1/code.obj -lprf -lc > pl1/code.map'  

This will be a bit too specific and only for 32-bit X86, but it's a start. 😄

And for run.sh

run "PL1" "./pl1/code.exe" "./pl1/code.exe" "${input}"

I hope this makes sense. The point is that the same script is used for compiling both loops and hello-world (and any other benchmark someone contributes) and that which one is compiled is determined from the directory from which compile.sh is run. Same for run.sh.

Removed to hello-world
Single apostrophes are more common as delimiter.
@markons
Copy link
Author

markons commented Jan 18, 2025 via email

@PEZ
Copy link
Collaborator

PEZ commented Jan 18, 2025

Hi!

Yes, let the program read from the file instead.

In this PR #365 I am actually proposing to change it so that all programs will read from a file instead of from the command line. (If we end up going with that proposal there will be some more work for the programs to also measure the run times and such, but you can disregard that for now.)

@PEZ
Copy link
Collaborator

PEZ commented Jan 26, 2025

Hi! Now we have started moving over to the in-process runner (and thus a Levenshtein program that should read from file instead of from command line args).

To get the PL1 contributions over will involve writing a benchmarking utility that does the running and measuring of the benchmarked function. See the updated project README for more on this and to find reference implementations. Let me know if there are something unclear or if you think I can help in some way.

@markons
Copy link
Author

markons commented Jan 26, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants