miking-lang / miking

Miking - the meta viking: a meta-language system for creating embedded languages
Other
51 stars 31 forks source link

Refactoring our builds and tests #707

Open elegios opened 1 year ago

elegios commented 1 year ago

Our build and test system is getting a bit unwieldy, and it currently requires a large number of files at the top-level of the repo. We'd like to address both of these points, and this issue is intended to track that effort.

Tasks

Targets/interface

Questions/problems:


Collected test information

larshum commented 1 year ago

For accelerate, there are specific test files (test/examples/accelerate/*.mc) that use acceleration, for which we try compiling and executing both with acceleration enabled and in debug mode (where we verify that the well-formedness checks pass). Relevant information for these tests:

Note that these tests are currently not included in make test-all. They have hardware requirements (a CUDA-compatible GPU), so I don’t think they should be included there for now.

johnwikman commented 1 year ago

Would this new Makefile setup be a wrapper for tup or a reworking of what we have now? I think the tup system looks nice and it would tie in nicely with the "quick" tests. Some additional comments:

elegios commented 1 year ago

Note that these tests are currently not included in make test-all. They have hardware requirements (a CUDA-compatible GPU), so I don’t think they should be included there for now.

This is an interesting and somewhat inconvenient point. I guess the ideal case is that if you run test-all without the correct hardware it should give a warning but not run those tests, and if you have the correct hardware it should run the tests whether you have the dependencies or not?

Also, @larshum, I'm guessing the files compiled with --accelerate and --debug-accelerate should also be run (with no arguments?), not just compiled?

Would this new Makefile setup be a wrapper for tup or a reworking of what we have now?

I don't think we should move to tup as the main/only build approach just yet, partly because of the FUSE difficulties on Mac, and partly because there's an issue that needs to be fixed before our setup works properly (I'm using a locally patched version until then).

  • Using Makefile patterns, you could parse additional target aspects to specify non-standard aspects that you also want to test. Such as make test/accelerate (quick tests + accelerate), make test/js (quick tests + javascript), or make test/accelerate/sundials (quick tests + accelerate and sundials). For example, I if I changed the underlying CUDA installation and want to rerun the accelerate tests only I could do it as make test/accelerate -B.

I did not know you could do quite that level of fanciness in make targets. It would certainly be convenient with a quick way of specifying different subsets. It's worth noting though that we're not really using make for it's intended purpose in most of this design (essentially no dependency tracking, just a collection of tasks to run), so it's not a given that we want to keep using make.

  • When you say "mi and boot library", do you refer to the executables? The Boot library is a dependency and must be installed, but I do not think that it makes sense to install the boot binary by default since that is not something you would use outside of the miking bootstrapping process.

I meant the mi executable and the boot library, but not the boot executable. I've updated the original issue to clarify.

larshum commented 1 year ago

Also, @larshum, I'm guessing the files compiled with --accelerate and --debug-accelerate should also be run (with no arguments?), not just compiled?

Yes, that's the idea — both compiling and executing.

br4sco commented 1 year ago

It is still not possible to build sundialsml with the opam switch we use with Miking and I'm not able to build it from source on Fedora 37.

If you want to check if it is installed I suppose you can do a ocamlfind query sundialsml. For the ipopt interface you can check for the required opam package with ocamlfind query ipoptml.

As you probably already know, the tests for these two are currently defined in test-sundials.mk and test-ipopt.mk.

lingmar commented 1 year ago
elegios commented 1 year ago

It is still not possible to build sundialsml with the opam switch we use with Miking and I'm not able to build it from source on Fedora 37.

If you want to check if it is installed I suppose you can do a ocamlfind query sundialsml. For the ipopt interface you can check for the required opam package with ocamlfind query ipoptml.

@br4sco Since these would be using externals I assume we expect them to fail when interpreted? The current compile tests seem to disable both optimizations and prune-utests, is that important here?

  • The files in test/examples/tuning are run with mi tune subcommand, as defined in test-tune.mk.

@lingmar I'm guessing that these tests should work in interpreted mode, but that they might be too slow for it? Maybe only some of them? Also, should they be compiled and run as normal as well, or just via tune?

lingmar commented 1 year ago

@lingmar I'm guessing that these tests should work in interpreted mode, but that they might be too slow for it? Maybe only some of them? Also, should they be compiled and run as normal as well, or just via tune?

They don't have to be compiled and run as normal, via tune is enough. Tuning is not supported in interpreted mode so that is not needed either.

br4sco commented 1 year ago

@br4sco Since these would be using externals I assume we expect them to fail when interpreted? The current compile tests seem to disable both optimizations and prune-utests, is that important here?

Sorry for the late reply. It is not important. You cannot currently do a test-all-prune-utest on the non-multicore switch unless you apply this patch.

diff --git a/test-files.mk b/test-files.mk
index 82b4601d..71c4f13a 100644
--- a/test-files.mk
+++ b/test-files.mk
@@ -60,6 +60,7 @@ compile_files_exclude += test/mlang/also_includes_lib.mc
 compile_files_exclude += test/mlang/mlang.mc
 compile_files_exclude += test/mlang/nestedpatterns.mc
 compile_files_exclude += test/mlang/catchall.mc
+compile_files_exclude += stdlib/multicore/thread.mc

 # Programs that we currently cannot interpret/test. These are programs written

I don't remember exactly why, but some dependency isn't pruned.

asta12 commented 1 year ago

The JVM backend stdlib/jvm/compile.mc : Dependencies: java and javac. I have been using version 17, but I think the lowest you can go is 11. Java 8 which is the most common one does not work! To see if they exist use which java and which javac. You can check the version with java --version and javac --version. This works for HopSpot, other JVMs might have other flags for checking the version.

asta12 commented 1 year ago

One more thing, I need some jar files to compile the java program used in the backend. Right now I fetch them from mvn repositories with curl in the backend. I do not know if it is better if they were fetched by some other script or something which prepares testing/running of the backend.