Command-line arguments

If we want to resize our image, we would need to edit the line const n = 2_000; in the code and then recompile it. Wouldn’t it be great if we could pass this number to the binary when it is called at the command line, without having to recompile it?

The Chapel mechanism for this is config variables. When a variable is declared with the config keyword, in addition to var or const, like this:

config const n = 2_000;   // vertical and horizontal size of our image

you can set its new value from the command line:

chpl juliaSetSerial.chpl
srun --mem-per-cpu=3600 ./juliaSetSerial   # using the default value 2_000
srun --mem-per-cpu=3600 ./juliaSetSerial --n=500   # passing another value from the command line
CautionExercise Basic.4

Make c a config variable, and test passing different values.