judge0 / ide

✨ Simple, free and open-source online code editor.
https://ide.judge0.com
MIT License
847 stars 256 forks source link

Autoformating #54

Open TeaObvious opened 4 years ago

TeaObvious commented 4 years ago

Hi,

@hermanzdosilovic can you estimate how much work would it be, to get an "Autoformat" button working?

I figured the easiest solution could be:

  1. take the source, send it to the judge api
  2. use astyle as "compiler"
  3. write the output back to the Implementation window (which might be the hard part)

For the Background: I am evaluating Online IDEs and i like the clear and simple structure of the judge0 IDE. I've got a student research assistant which i want to give the task to get judge0 running with MPI support for multiple cluster nodes, since i want to use it to teach parallel programming. So while being at this, i am evaluating if i also want him to add this comfort feature, just to improve the readability of code. :)

Thank you and your pals for this nice platform!

Have a very good day, Ronny

hermanzdosilovic commented 4 years ago

Hi Ronny,

I am familiar with the MPI and you can see that I have added support for it in Judge0 for C, C++, and Python. I am not sure how you could make it work in Judge0 with support for multiple nodes. This seems a lot of work from my perspective.

But, back to your question about astyle.

For me, this is not much work to add support for running astyle for multiple or single file program, but for your student it could be at least a week or two.

You are welcome. :)

Best, Herman

TeaObvious commented 2 years ago

We did not run MPI in parallel across multiple nodes, but we of course used parallel MPI Execution in a single node.

We modified it such, that you can't provide cmd parameters to the programm it self, instead the command line arguments are used to, for example, pass "-n 5" to mpirun.

Then we altered judge0/db/languages/active.rb a bit, such that it shows where the Code was executed: run_cmd: "./a.out && echo && echo Calculated on && cat /proc/sys/kernel/hostname"

How ever, i can't remember what else we hat to touch to make it usable.

Originally posted by @TeaObvious in https://github.com/oboha55/fahad/issues/8#issuecomment-1022590406

TeaObvious commented 2 years ago

I've asked our former student, who worked on this Project, to report what he knows, i left my teaching position, hence i have no overview anymore.