chunhualiao / freeCompilerCamp

Goal: a website to automatically train and certify compiler researchers and developers
10 stars 1 forks source link

enabling different containers to be loaded for different tutorials #100

Closed chunhualiao closed 3 years ago

chunhualiao commented 4 years ago

The next major improvement should be enabling different containers to be loaded for different tutorials. This requires some go or js programming.

ouankou commented 4 years ago

Finally, the problem can be solved. https://github.com/freeCompilerCamp/freecompilercamp.github.io/blob/56ea9e6d168f25628462dd6e14490f3c26b1325c/_layouts/post.html#L101 At the end of this line, a string variable page.image is used to indicate which docker image we'd like to use to create a sandbox. If nothing is set in the tutorial markdown file, the default image will be used. If we set this variable in a markdown post, in this tutorial that specific image will be used.

I have two examples on my repo forked from FreeCC. It's also connected with the Play-With-Compiler AWS server. https://github.com/ouankou/freecc/blob/gh-pages/_posts/2019-07-26-fix-bug-in-rose.markdown In this post, I specified that image: franela/dind, which is the simple demo image. Then if you go to the corresponding link http://freecc.ouankou.com/fix-bug-in-rose/, in its sandbox, the root user is shown and it's basically an empty docker container. For comparison, if you check any other tutorial on the same website, it uses our fully functional docker image and shows freecc user, such as http://freecc.ouankou.com/llvm-openmp-build/.

Therefore, we can create multiple different docker images on AWS server, then add them as available images in the PWC config file. https://github.com/freeCompilerCamp/play-with-compiler/blob/6d771b0133478afe2765b3df7b81a4c8cadde8fa/api.go#L55 In this line, we can add a string, such as franela/dind to the variable AvailableDinDInstanceImages. Then it can be used in the post image variable mentioned above.

chunhualiao commented 4 years ago

@ouankou It looks like the current docker has been upgraded to use LLVM github's source. At least one tutorial no longer works : http://freecompilercamp.org/llvm-pass/

freecc@node1:llvm_src$ cd $LLVM_SRC/lib/Transforms
bash: cd: /home/freecc/source/llvm_src/lib/Transforms: No such file or directory

I will fix this tutorial myself.

How far along is your work of enabling tutorial-specific docker on the server ? With this feature, we can just add new dockers with new compiler versions, and only update the link to use the new dockers when an existing tutorial is tested to be working.

ouankou commented 4 years ago

@ouankou It looks like the current docker has been upgraded to use LLVM github's source. At least one tutorial no longer works : http://freecompilercamp.org/llvm-pass/

freecc@node1:llvm_src$ cd $LLVM_SRC/lib/Transforms
bash: cd: /home/freecc/source/llvm_src/lib/Transforms: No such file or directory

I will fix this tutorial myself.

How far along is your work of enabling tutorial-specific docker on the server ? With this feature, we can just add new dockers with new compiler versions, and only update the link to use the new dockers when an existing tutorial is tested to be working.

The feature of using specific docker image is on already (https://github.com/freeCompilerCamp/play-with-compiler/commit/35e721f19e127df61e406c4cefa22a631819abb2). I changed the default docker image to use latest LLVM source on Ubuntu 18.04. I'll add proper image tags to previous tutorials.

So far FreeCC enables 5 docker images:

freecompilercamp/pwc:18.04: LLVM 10.x built from GitHub source and ROSE release on Ubuntu 18.04, the current default image used by any tutorial not specifying docker image. freecompilercamp/pwc:16.04 = freecompilercamp/pwc:1.0: LLVM 8.0 built by Alok and ROSE release on Ubuntu 16.04. This is the version we used by default before recent updates. freecompilercamp/pwc:llvm10: LLVM 10.x built from GitHub source on Ubuntu 18.04. fcc_docker:test: It could be anything. It's used only for testing purpose, not for tutorials.

chunhualiao commented 4 years ago

Please document this feature with instructions about how to use it. Then close this issue.

Thanks.

On Fri, Jun 12, 2020, 1:00 PM Anjia Wang notifications@github.com wrote:

@ouankou https://github.com/ouankou It looks like the current docker has been upgraded to use LLVM github's source. At least one tutorial no longer works : http://freecompilercamp.org/llvm-pass/

freecc@node1:llvm_src$ cd $LLVM_SRC/lib/Transforms bash: cd: /home/freecc/source/llvm_src/lib/Transforms: No such file or directory

I will fix this tutorial myself.

How far along is your work of enabling tutorial-specific docker on the server ? With this feature, we can just add new dockers with new compiler versions, and only update the link to use the new dockers when an existing tutorial is tested to be working.

The feature of using specific docker image is on already ( freeCompilerCamp/play-with-compiler@35e721f https://github.com/freeCompilerCamp/play-with-compiler/commit/35e721f19e127df61e406c4cefa22a631819abb2). I changed the default docker image to use latest LLVM source on Ubuntu 18.04. I'll add proper image tags to previous tutorials.

So far FreeCC enables 5 docker images:

freecompilercamp/pwc:18.04: LLVM 10.x built from GitHub source and ROSE release on Ubuntu 18.04, the current default image used by any tutorial not specifying docker image. freecompilercamp/pwc:16.04 = freecompilercamp/pwc:1.0: LLVM 8.0 built by Alok and ROSE release on Ubuntu 16.04. This is the version we used by default before recent updates. freecompilercamp/pwc:llvm10: LLVM 10.x built from GitHub source on Ubuntu 18.04. fcc_docker:test: It could be anything. It's used only for testing purpose, not for tutorials.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chunhualiao/freeCompilerCamp/issues/100#issuecomment-643459401, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMNIRVQ2RCFD72IYJ7KLJLRWKCOJANCNFSM4JQIVT6Q .

chunhualiao commented 4 years ago

@ouankou The page to include the instructions is https://github.com/freeCompilerCamp/freecompilercamp.github.io/blob/master/contribute.md Thanks.

ouankou commented 4 years ago

The instruction of specifying a docker image in the tutorial has been added (https://github.com/freeCompilerCamp/freecompilercamp.github.io/commit/1a99792b8dfa983cd9eaaae221944970b1e74910). The list of available docker images is added as well.

chunhualiao commented 4 years ago

@ouankou For contribute.md, section 1.a update headers, can you link to an example tutorial's source file using some specific image?

We use https://github.com/freeCompilerCamp/freecompilercamp.github.io/blob/master/contribute.md as the example, you might to revise it to use the new image field.

ouankou commented 4 years ago

I've specified the autopar tutorial to use ROSE-only docker image and use that as example to show how to specify a image in the markdown file (https://github.com/freeCompilerCamp/freecompilercamp.github.io/commit/171bfff760e4d844e77e31cef3837ed81d56c915).