Version: | 1.3 (October 31, 2007) |
---|
This file describes how to use a binary package of SILC precompiled for Win32 environments. A binary package is distributed in the form of a zipped archive having a file name like silc-1.3-mingw32.zip. The package contains a set of executable files, including both a SILC server and sample user programs for SILC. The package has been tested on Windows XP SP2. If you have a Windows machine and you want to try out SILC by playing with some sample user programs, the binary package will meet your needs.
Extract all files in the binary package into a directory. In this document, it is assumed that the extracted files exist in the C:\silc-1.3\ directory.
Open a command prompt (e.g., by selecting the Start menu >> All Programs >> Accessories >> Command Prompt) and change the current directory to the C:\silc-1.3\src\server\ directory as follows:
> C: > cd \silc-1.3\src\server
Start a SILC server by running server.exe as follows:
> server
The server runs in the foreground, printing some debugging information as illustrated below:
single thread load_modules("./modules/formats") silc_register_format("SILC:dense (column major)") silc_register_module("dense") silc_register_format("SILC:Band") silc_register_module("sparse_band") silc_register_format("SILC:CRS") silc_register_module("sparse_crs") silc_register_format("SILC:JDS") silc_register_module("sparse_jds") load_modules("./modules") silc_register_module("blasmodule") silc_register_module("coremodule") silc_register_module("leq_cg") silc_register_module("leq_gs") silc_register_module("leq_lis") silc_register_module("leq_lu") silc_register_module("linpackmodule")
Open another command prompt and change the current directory to C:\silc-1.3\src\client\. This directory contains executable files of sample user programs for SILC:
> C: > cd \silc-1.3\src\client
Run a user program (demo3.exe for instance) in the new command prompt as follows:
> demo3
This program establishes a connection to the SILC server that is running in the other command prompt, and solves a system of linear equations Ax = b by means of an appropriate linear solver that the server makes available. The program prints some debugging information and terminates after displaying its execution time (in seconds) and the solution's residual norm ||b-Ax|| as illustrated below:
0.063935s ||b-Ax|| = 3.839510e-015
The actual numbers may vary; if you get similar results, the program works fine.
You can also use the console program (console.exe) in the same directory to interactively carry out matrix computations by means of SILC's mathematical expressions:
> console
The following example shows how to compute matrix-vector products A * b and b' * A using the console program, where A is a 2-by-2 matrix, b is a 2-vector, and the single quote ' means transposition:
> A = {1, 2; 3, 4} > b = {5, 6} > x = A * b > pprint x column vector, 2 elements of int [1] = 23 [2] = 34 > x = b' * A > pprint x row vector, 2 elements of int [1] = 17 [2] = 39 >
Letters after > of each line are user's input. Type Ctrl-Z to exit. For more information, take a look at the README.console.en file.
Note: If you get some error message with regard to .dll files, try setting the PATH environment variable as follows:
> set PATH=C:\silc-1.3\src\server;%PATH%
SILC User's Manual describes how to develop application programs (referred to as user programs) for SILC. The manual deals with user programs written in C and Fortran.
You can also write user programs for SILC in object-oriented scripting language Python (http://www.python.org/). At the moment, however, there is no document about the development of user programs in Python. It is worth noting that there is a good correspondence between user programs in Python and those in C. You can find sample programs in Python in the src\client\python\ directory.
What you need to do to create a user program in C and Fortran is summarized as follows:
The rest of this section describes how to compile a sample program mmul.c, which computes a square of matrix A (i.e., a matrix-matrix product), by using Microsoft Visual Studio .NET 2003 as well as MinGW (GCC for Windows). The source code of mmul.c is as follows (please consult "SILC User's Manual" for the details of functions and constants in the code):
#include <stdio.h> #include "client.h" int main(int argc, char *argv[]) { silc_envelope_t object; double A[4] = {1.0, 2.0, 3.0, 4.0}; double X[4]; SILC_INIT(); object.v = A; object.type = SILC_MATRIX_TYPE; object.format = SILC_FORMAT_DENSE; object.precision = SILC_DOUBLE; object.m = object.n = 2; SILC_PUT("A", &object); SILC_EXEC("X = A * A"); object.v = X; SILC_GET(&object, "X"); SILC_FINALIZE(); printf("A =\n"); printf(" %e %e\n", A[0], A[2]); printf(" %e %e\n", A[1], A[3]); printf("A * A =\n"); printf(" %e %e\n", X[0], X[2]); printf(" %e %e\n", X[1], X[3]); }
Using Microsoft Visual Studio .NET 2003
The main points of the instructions to be presented are as follows:
Detailed instructions are as follows:
Start Microsoft Visual Studio .NET 2003 and create a new project by selecting Visual C++ Projects >> Win32 Console Project. Enter the project's name (mmul for example) in the Name entry.
Figure 1: Creating a new project.
The following files are automatically created when you create the new project. These files are unnecessary in this tutorial, so delete them as well as their folders.
Note that only references to the files are deleted in this step. The actual files can be deleted in the next step.
Figure 2: Removing unnecessary files.
Move or copy the following files to the Visual Studio Project\mmul\ directory in My Documents:
Also delete the four files listed in Step 2 at this point of time.
Figure 3: Adding and removing files.
Add the three files listed in Step 3 by selecting Project >> Add Existing Item.
Figure 4: Adding existing items.
Select Project >> Properties (or press the highlighted button in Figure 5) and change properties as described below:
Figure 5: Changing properties of the project.
Compile and link the program by selecting Build >> Build Solution. If compilation and linking have succeeded, executable file mmul.exe is created in the Visual Studio Projects\mmul\Debug\ directory in My Documents.
Figure 6: Building the user program.
Open a command prompt by selecting the Start menu >> All Programs >> Accessories >> Command Prompt and start a SILC server as follows:
> C: > cd \silc-1.3\src\server > server
Open another command prompt and run the user program as follows:
> C: > cd "My Documents\Visual Studio Projects\mmul\Debug" > mmul connected to kajiyama on port 1639 number of formats = 4 0: "SILC:dense (column major)" 1: "SILC:Band" 2: "SILC:CRS" 3: "SILC:JDS" Request: >A Response: 200 OK Request: :9:X = A * A Response: 200 OK Request: <X Response: 200 OK A = 1.000000e+000 3.000000e+000 2.000000e+000 4.000000e+000 A * A = 7.000000e+000 1.500000e+001 1.000000e+001 2.200000e+001 >
If you get similar results to the above, the program works fine.
Figure 7: Running a SILC server and the user program.
Using MinGW (GCC 3.2.3)
MinGW (http://www.mingw.org/) is a Windows version of GCC. You can obtain a complete installation of GCC 3.2.3 by downloading and running the following installers in this order:
Instructions on how to compile mmul.c using MinGW are shown below:
Open a command prompt by selecting the Start menu >> All Programs >> Accessories >> Command Prompt and change the current working directory to the directory where mmul.c exists.
Run the gcc command to compile mmul.c as follows:
> gcc -IC:/silc-1.3/src/client -c mmul.c > gcc -LC:/silc-1.3/src/client -o mmul mmul.o -lsilc -lws2_32
The -I and -L options specify the directories where client.h and libsilc.a exist. The -lws2_32 option is needed to link the WinSock2 library to the user program.
If you want to modify the user program and compile it repeatedly, it is worth creating Makefile shown below:
all: mmul SILC= C:/silc-1.3 CC= gcc CFLAGS= -I$(SILC)/src/client LDFLAGS= -L$(SILC)/src/client LIBS= -lws2_32 mmul: mmul.c $(CC) $(CFLAGS) -c mmul.c $(CC) $(LDFLAGS) -o $@ mmul.o -lsilc $(LIBS)
With the above file placed in the same directory as mmul.c, run the make command to compile the user program as follows:
> make
Open another command prompt and run a SILC server:
> C: > cd \silc-1.3\src\server > server
Then, run the user program in the first command prompt:
> mmul connected to kajiyama on port 1639 number of formats = 4 0: "SILC:dense (column major)" 1: "SILC:Band" 2: "SILC:CRS" 3: "SILC:JDS" Request: >A Response: 200 OK Request: :9:X = A * A Response: 200 OK Request: <X Response: 200 OK A = 1.000000e+000 3.000000e+000 2.000000e+000 4.000000e+000 A * A = 7.000000e+000 1.500000e+001 1.000000e+001 2.200000e+001 >
If you get similar results to the above, the program works fine.
The copyright holder of this software is the SSI Project. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the LICENSE file for the precise terms and conditions for the use of this software.
This software contains the following pieces of software by other people and projects. Please use them according to the license terms and conditions specified by their copyright holders.
src\server\libblas.dll, src\server\liblapack.dll
BLAS and LAPACK from the Netlib (http://www.netlib.org/).
src\server\dgefa.f, src\server\dgesl.f
LINPACK from the Netlib (http://www.netlib.org/).
src\lib\mt\mt19937ar.c, src\lib\mt\mt19937ar.h
These files are part of Mersenne Twister, which is freely available at the following location:
We appreciate your comments, bug reports, feature requests, and so on. Please feel free to use the following address to write us:
The SSI Project <devel at ssisc.org>
$Id: README.win32.en,v 1.11 2007/10/31 05:18:48 kajiyama Exp $