Page 3 of 3
Sidebar Two: task.c |
/* *======================================================================== * task.c *======================================================================== */ #include |
Sidebar Three: Makefile for task.c | |
# $Id: first_cluster.txt,v 1.4 2003/09/07 14:45:43 rgb Exp $ #======================================================================== # Defines/Macros PROGRAM = task SOURCE = $(PROGRAM:=.c) OBJECT = $(PROGRAM:=.o) CC = gcc CFLAGS = -O3 LDFLAGS = LIBS = -lm # Targets all: $(PROGRAM) $(PROGRAM): $(OBJECT) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBS) $(OBJECT) clean: rm -f core $(PROGRAM) $(OBJECT) # Rules %.o:%.c $(INCLUDES) $(CC) -c $(CFLAGS) $< |
Sidebar Four: taskmaster (perl) listing |
#!/usr/bin/perl #======================================================================== # $Id: first_cluster.txt,v 1.4 2003/09/07 14:45:43 rgb Exp $ #======================================================================== use Config; use threads; # Set the path to the task. You may prefer to use a path in your # home directory on a shared filesystem. my $taskpath = "/tmp/task"; $Config{useithreads} or die "Upgrade to perl >= 5.8.0, compiled with threads"; # Get required arguments (2) from command line $verbose = 1; $ARGC = @ARGV; if($ARGC != 4){ Usage("Incorrect number or type of arguments"); exit; } $hostfile = $ARGV[0]; $nhosts = $ARGV[1]; $nrands = $ARGV[2]; $delay = $ARGV[3]; # Get list of host names open(FD,$hostfile) || die "$0: can't open $hostfile"; $i = 0; while( |
This article was originally published in ClusterWorld Magazine. It has been updated and formatted for the web. If you want to read more about HPC clusters and Linux you may wish to visit Linux Magazine.
Robert Brown, Ph.D, is has written extensively about Linux clusters. You can find his work and much more on his home page at http://www.phy.duke.edu/~rgb.