DPG school
DPG school
DPG school on efficient algorithms in computational physics
Organized by A.K. Hartmann and A.P. Young (UCSC).
10-14. September, Physik Zentrum Bad Honnef, Germany
A general overview, including scope, invited lecturers and program is ready for download.
An essential part of the school will be hands-on exercises. For this purpose you should bring your own laptop with you (at least half of the participants should have a laptop). We do not require a specific operation system/delevment environment, but should be be able to:
- Edit source code files in C/Python/Perl (e.g., using emacs)
- compile C programs (e.g., using cc/gcc), and run Phython/Perl scripts.
- runs programs/scripts including passing parameters (e.g., from a shell)
-
plot resulting data files, mainly x-y format (e.g., using gnuplot)
Note that we strongly recommend to use Linux/Unix/Mac(Xcode), because high-performance scientific computing is based almost everywhere on this class of operating systems.
Here, we provide a couple of sample programs, which allow you to test your system:
Part 1
- Download the C source code insertion_sort.c. The program can sort a given sequence of number via a simple algorithm. Open it in an editor, it should look like this.
- Compile the C program using your favorite compiler/development environment. Under Linux/Unix, in a shell (bash etc), this can be achieved by entering
cc -o insertion_sort insertion_sort.c
- Run the program via piping the input file from the standard input. In the shell:
insertion_sort < input
sort 7 numbers:
1 3 2 6 8 11 5
sorted sequence:
1 2 3 5 6 8 11 - Finally, try to redirect the output to a file, e.g. via
insertion_sort < input > sort.out
Part 2
- Download the source codes main.c, r1279.c, r1279.h and seedgen.c, as well as the Makefile. The program realizes a pseudo random number generator and calculates the average of N U(0,1) distributed random numbers and the difference to the expectation value 0.5.
- Compile the C programs using your favorite compiler/development environment. If you have installed the make tool, you can use the given Makefile, e.g., in a Unix/Linux shell by just entereing make. You can also compile by calling directly the compiler:
cc -o runme main.c r1279.c seedgen.c
- Run the program (e.g. by entering just the program name runme). For further testing, you can change the parameter N in the program source, recompile and observe how the average changes when increasing N.
Part 3
- Download two data files data1 and data2 as well as the analysis script mean_stdev.pl (Perl) and/or mean_stdev.py (Python). Both scripts take one or more x-y inoput files, where several lines may have the same x value. The scripts show, respectively, for each occuring value of x, the average and standard error of the corresponding y values.
- Perform the analysis with the file, e.g., by entering in a shell (here for the Perl script)
mean_stdev.pl data1 data2 T n_point y_av error
0.1000 20 2.0233 0.1755
0.2000 20 4.0136 0.2265
0.3000 40 6.2299 0.1342
0.4000 40 7.9167 0.1633
0.5000 40 9.6538 0.1397
0.6000 40 11.7799 0.1589
0.7000 40 14.0318 0.1574
0.8000 20 15.9940 0.1848
0.9000 20 18.0720 0.2359
1.0000 20 20.4071 0.2442