Compiling, Gradebot and Homework 4

You are to submit your programs to Gradebot before uploading them to SmartSite. Gradebot will grade their correctness. What follows assumes that you have your Gradebot keys set up properly; if not, see the handout All About Homework to learn how to do this.

Problem 6

Problem 6 asks you to write a program that computes the Fibonacci numbers in two ways, recursively and iteratively; the interface is documents in the assignment.

To help you, we have placed a reference executable in the file /home/bishop/ecs30/reffibs in the CSIF. It is the one Gradebot uses to evaluate your program (noting, of course, that the Gradebot times may be different than yours) There is also a file containing precompiled timing routines, /home/bishop/ecs30/timeit.o, that is the same as the one Gradebot links to your function. You should use that to do the timings. The example file /home/bishop/ecs30/timeex.c is a small program that uses the functions; you can use that to see how to call them.

The easiest way to do this assignment is to simply write your function in a file named “fibs.c”, put the “timeit.o” file in the same directory, and type:

gcc -ansi -pedantic -Wall -o fibs fibs.c timeit.o
Now you have a program that will time the iterative and recursive versions — assuming your program calls the functions correctly.

Creating the Gradebot Work Area

First, log into the CSIF. (You can do this on your laptop, but the steps may work differently.) Next, go to where you want the work area directory to be. Then type:

git clone
where your_ucd_email is your UC Davis email, with the “” deleted. Note the “5” at the end of the command; as this problem has ID 5, you need to get the corresponding work area. For example, my UC Davis email is “”, so I would type:
git clone
to create my Gradebot work area. That area is now in the directory named “5”.

What to Submit to Gradebot

When you want to submit your function for grading, copy it into the directory “5”. You should not submit “timeit.o”. (If you do, Gradebot will ignore it, so no harm done.) Gradebot has the same file, and uses its copy to compile the program.

Once you have “fibs.c” in the directory “5”, go to that directory and type the following commands:

git add fibs.c
git commit -m ’change message
git push origin master

The first command informs git that you have added a (new or changed) file to the repository.

The second command adds a change message, which is a very brief description of what you changed. Remember to put the single quotation marks around the message, or it will not work right (and give you very mysterious error messages! For this step, if you prefer to use the vim(1) editor to enter your comment, say instead:

git commit -a
and the editor will come up.

The third command actually pushes your file over to Gradebot, which will promptly run it. It may take a minute or two, especially if a lot of people are using Gradebot at the time, so look at the “Submissions being graded” and “Submissions to be graded” part of the Gradebot window.

Submitting the Programs for Grading

Once you have finished the programs and are happy with the results, you have to submit the files to the homework area in SmartSite. You can do this by physically going to the CSIF and uploading them there. Or, you can transfer them to your laptop or home computer and upload them from there. If you do the latter, watch out for character conversion problems. The ASCII printing characters will be transferred correctly, except for the end of line marker; this may be changed to a carriage return, a line feed, or some combination of the two. But if you have non-ASCII characters such as any accented letters, emoticons, or non-Latin letters, those will probably not transfer correctly.

Troubleshooting Submitting to Gradebot

If you have trouble getting Gradebot to run your program, but have done so successfully before, then the problem is almost certainly not your key. Try the following steps.

First, be sure you are looking at the current version of the Gradebot page. Gradebot does not send updates to your browser; you have to pull them over. So try refreshing the window in your browser. Check the time when you submitted your last version. If Gradebot didn’t run your program, then go on to the next step.

Next, be sure you have set up your work area and you execute the three git commands from within that directory. It’s very common to forget the first or second command, or to execute the commands in the parent directory, and in these cases the program won’t get sent over to Gradebot.

Third, be sure you are executing the git commands from the work area. If you see an error like:<br>

fatal: Not a git repository … ...
<br> this is almost certainly what caused the failure. Find the right working area, change to it, and rerun the command.

If none of these are it, here are a couple of other things to check.

  1. You submitted it in the wrong work area. For example, you put “fibs” in an old working directory, like “2” or “3” (it should be in directory “5’). If you see the following error message in the box on the Messages page, this is almost certainly the reason.
    make: *** No rule to make target ‘fibs’. Stop.

  2. The change comment in the second step is empty. This tells git that there have been no changes, and so the third step gives an error, as git thinks there is nothing to push over. If you use the -a option on this command, you may have put “#” as the first character of the line. Delete that. The “#” at the beginning means the line is a comment and so is ignored.

  3. You made no changes to the source code. The program will be pushed over, but Gradebot will compare it to what you submitted before. If you haven’t made any changes, Gradebot thinks it has already run the program, and won’t do it again. In this case, just find a comment and add a blank to it (or make any other change). Then rerun the three git commands again.

You can also obtain a PDF version of this. Version of November 13, 2015 at 11:14PM