source: git/ntl/doc/tour-win.html @ 6ce030f

spielwiese
Last change on this file since 6ce030f was de6a29, checked in by Hans Schönemann <hannes@…>, 19 years ago
* hannes: NTL-5.4 git-svn-id: file:///usr/local/Singular/svn/trunk@8693 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 11.1 KB
Line 
1<html>
2<head>
3<title>
4A Tour of NTL: Obtaining and Installing NTL for Windows
5and other Platforms </title>
6</head>
7
8<body bgcolor="#fff9e6">
9<center>
10<a href="tour-unix.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a>
11 <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> 
12<a href="tour-tips.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a>
13</center>
14
15<h1> 
16<p align=center>
17A Tour of NTL: Obtaining and Installing NTL for Windows
18and other Platforms
19</p>
20</h1>
21
22<p> <hr> <p>
23
24The WinNTL distribution of
25NTL can be used on any Windows 95 or NT platform
26(but not on Windows 3.11 or earlier).
27Actually, there is nothing Windows-specific about WinNTL.
28The source code is identical to the UNIX NTL distribution;
29only the packaging is slightly different, and no assumptions
30are made about the program development environment.
31Thus, it should be possible to install WinNTL on
32other operating systems (e.g., Macintosh, OS/2)
33with little difficulty.
34
35<p>
36<b>MAC OSX Users:</b>
37since MAC OSX is essentially just a (rather funny) flavor of Unix,
38you will be much better served using the
39<a href="tour-unix.html">Unix distribution</a>.
40
41
42<p>
43<b>
44Obtaining and unpacking NTL.
45</b>
46<p>
47
48To obtain the source code and documentation for NTL,
49<a href="http://www.shoup.net/ntl/download.html">
50download <tt>WinNTL-xxx.zip</tt></a>.
51Here, "<tt>xxx</tt>" is the current version number.
52Then <tt>unzip</tt> this file into a directory (folder).
53This will unpack everything into a directory called "<tt>WinNTL-xxx</tt>".
54Inside this directory, you will find several directories.
55
56<p>
57
58<ul>
59<li>
60
61The directory "<tt>doc</tt>" contains all of NTL's documentation,
62including this "tour" ("<tt>tour.html</tt>")
63and the "<tt>.txt</tt>" files explaining each module,
64which can be accessed directly, or through the "tour".
65
66<p>
67<li>
68
69The directory "<tt>src</tt>"
70contains all of the source files for the library,
71all with "<tt>.cpp</tt>" extensions.
72The file "<tt>lip.cpp</tt>" can be compiled as a C source file
73(this can sometimes yield a marginal performance gain).
74
75<p>
76<li>
77
78The directory "<tt>include</tt>" contains a single directory called
79"<tt>NTL</tt>",
80and the latter contains all of the "<tt>.h</tt>" files.
81
82</ul>
83
84<p>
85
86<b>
87Platform dependent macros.
88</b>
89<p>
90
91In directory "<tt>include/NTL</tt>" there is a file called
92"<tt>mach_desc.h</tt>",
93which contains all of the platform-dependent macro definitions.
94The default settings should be correct for any x86- or Pentium-based
95system running Windows; however, the correct definitions
96can depend on the compiler and run-time environment.
97Therefore, to be on the safe side,
98you might consider compiling and running the program <tt>MakeDesc</tt>,
99whose source files are in directory "<tt>MakeDesc</tt>".
100This program will
101dynamically build
102a correct "<tt>mach_desc.h</tt>" for your platform (processor, compiler,
103run-time environment).
104To get accurate results,
105you must compile this program using the level of optimization
106(or higher) that you will use for NTL.
107The program will print some diagnostics to the screen,
108and create the file "<tt>mach_desc.h</tt>" (in the current
109directory, and not in the "<tt>include/NTL</tt>" directory,
110where it needs to go).
111
112<p>
113<b>
114Configuration flags.
115</b>
116<p>
117
118Also in directory "<tt>include/NTL</tt>" is a file called "<tt>config.h</tt>".
119You can edit this file to override some of NTL's default options
120for <i>basic configuration</i> and <i>performance</i>.
121
122<p>
123
124<dl>
125<dt>
126<i>Basic configuration options.</i>
127<dd>
128Most of the these flags are rather esoteric and can be safely
129ignored.
130<p>
131
132One exception to this is the <tt>NTL_STD_CXX</tt>  flag
133(or perhaps just the <tt>NTL_PSTD_NNS</tt> flag) which
134you will want to unset if your compiler is too old
135to handle it.
136<a href="tour-stdcxx.html">Go here</a> for details.
137
138<p>
139
140Another exception are the flags to use GMP for potentially
141faster long integer arithmetic.
142See the <a href="tour-gmp.html">GMP</a> section for more details.
143Note that getting GMP to run on Windows is a pain in the neck.
144If you really want to use GMP, use Unix or Linux!
145
146<p>
147
148<dt>
149<i>Performance options.</i>
150<dd>
151These flags let you fine tune for best performance.
152(If you were using Unix, you could run a script that
153automatically selects the best settings for your platform.)
154
155
156<p>
157<i>TIP for Pentium platforms:</i> 
158<ul>
159<li>
160Users running
161on a Pentium, or other x86-like processor,
162will almost surely want to set the <tt>NTL_LONG_LONG</tt> flag,
163or possibly the <tt>NTL_AVOID_FLOAT</tt> flag, in file <tt>config.h</tt>
164to get the best performance for long integer arithmetic.
165If you set either of these flags, you should also set the
166<tt>NTL_TBL_REM</tt> flag as well, to get the best
167performance for <tt>ZZ_pX</tt> arithmetic.
168You might also want to set the <tt>NTL_SPMM_ULL</tt> or <tt>NTL_SMPP_UL</tt>
169flags.
170
171<li>
172These flags can be useful on other platforms as well,
173especially on processors with slow int/float conversion.
174
175<li>
176The best thing is to experiment, and compile and run program <tt>QuickTest</tt>
177to see the impact on the running time of various basic operations.
178</ul>
179</dl>
180
181<p>
182Note that the file "<tt>def_config.h</tt>"
183contains a backup copy of the original <tt>config.h</tt> file.
184
185
186<p>
187<b>
188Test programs.
189</b>
190<p>
191
192The directory "<tt>tests</tt>" contains several test programs.
193For each program <tt>FooTest</tt>, there is a source file
194"<tt>FooTest.cpp</tt>", and optionally two files
195"<tt>FooTestIn</tt>" and "<tt>FooTestOut</tt>".
196If the latter  exist, then the program should be run with
197the "<tt>FooTestIn</tt>" as standard input;
198correct output (printed to standard output) should match
199the contents of "<tt>FooTestOut</tt>" exactly;
200note that these programs also print diagnostic output on the screen
201(through standard error output).
202
203<p>
204<b>
205Timing functions.
206</b>
207<p>
208
209The directory "<tt>GetTime</tt>" contains several alternative
210definitions of the <tt>GetTime()</tt> function.
211The file "<tt>GetTime.cpp</tt>" in the "<tt>src</tt>" directory should be OK,
212but your compiler might like one of the definitions in
213the directory "<tt>GetTime</tt>" better.
214
215<p>
216<b>
217Other tools.
218</b>
219<p>
220
221The directory "<tt>misc</tt>" contains a program <tt>newnames.cpp</tt>
222to help make the
223transition to NTL version 3.5 from earlier versions of NTL.
224See the <a href="tour-changes.html">changes</a> section for more details.
225It also contains the programs <tt>gen_lip_gmp_aux.cpp</tt>
226and <tt>gen_gmp_aux.cpp</tt> that automatically generate
227the auxilliary files needed when using NTL with GMP.
228You will have to look at the makefile in the Unix distribution
229to see how to use these.
230
231
232
233<p>
234<b>
235Compiling NTL.
236</b>
237<p>
238
239Since there are a number of incompatible compilers and program development
240environments available for Windows, no attempt has been made to
241provide automatic tools for building and testing,
242as is done for the Unix distribution.
243Nevertheless,
244it should be straightforward to install NTL (even if it involves a bit of
245pointing and clicking).
246First, compile all of the files in "<tt>src</tt>", and create a static library.
247Make sure the compiler knows where to find NTL's include files
248(directory "<tt>include</tt>" and <i>not</i> "<tt>include/NTL</tt>")
249Then, to compile a program using the library,
250make sure the compiler knows about the library and the directory
251of NTL's include files.
252In any case, if you want to do any serious computations,
253you will certainly  want to compile everything with your
254compiler's code optimizer on.
255
256<p>
257For the benefit of those who must use Microsoft Visual C++ on Windows,
258here are some steps for compiling and using NTL.
259These steps work with MSVC++ v6.
260While these steps seem to do the job,
261there may be other steps that work better.
262
263The following steps may be used to build the library,
264and to build and run program <tt>QuickTest</tt>, as a simple
265<i>console application</i>, using the library.
266The instructions assume you have already
267unzipped NTL into a directory <tt>c:\mystuff</tt>,
268and are running the MSVC++ Development Studio.
269
270<p>
271I hope these instructions make some sense:
272I don't know a good language for accuratly describing the
273particular pointing an clicking steps.
274
275<p>
276
277<pre>
278
279File -&gt; New -&gt; Projects
280   project name: ntl
281   location[default]: c:\Program Files\Microsoft Visual Studio\MyProjects\ntl
282   Click on Win32 static library
283   Click on OK
284   pre-compiled headers[default]: no
285   MFC support[default]: no
286   Click on Finish
287   Click on OK
288
289Project -&gt; Add to Project -&gt; Files
290   select all files in c:\mystuff\WinNTL-xxx\src and click on OK.
291
292Project -&gt; Settings -&gt; C/C++
293   Category: Preprocessor.
294   Additional include directories: c:\mystuff\WinNTL-xxx\include.
295   Click on OK.
296
297Build -&gt; build ntl.lib
298
299File -&gt; New -&gt; Projects -&gt; Win32 Console Application
300   project name: test
301   location[default]: c:\Program Files\Microsoft Visual Studio\MyProjects\ntl
302   Click on Win32 Console Application
303   Click on OK
304   What kind of windows application...? [default]: An empty project
305   Click on Finish
306   Click on OK
307
308Project -&gt; Add to Project -&gt; Files
309   select the file c:\mystuff\WinNTL-xxx\tests\QuickTest.cpp
310   Click on OK
311
312Project -&gt; Add to Project -&gt; Files
313   select the file
314      c:\Program Files\Microsoft Visual Studio\MyProjects\ntl\Debug\ntl.lib
315   Note: one must select Files of type: Library Files (.lib) to make this
316      file visible in the pop-up window.
317   Click on OK
318
319Project -&gt; Settings -&gt; C/C++
320   Category: Preprocessor.
321   Additional include directories: c:\mystuff\WinNTL-xxx\include.
322   Click on OK.
323
324Build -&gt; build test.exe
325
326Build -&gt; execute test.exe
327
328</pre>
329
330<p>
331<b>
332Further remarks.
333</b>
334<p>
335
336<p>
337<i>TIP:</i>  When writing programs using NTL,
338you should include files using the syntax
339<pre>
340   #include &lt;NTL/ZZ.h&gt;
341</pre>
342and <i>not</i> using a backslash ("<tt>\</tt>") as a delimiter.
343
344<p>
345<i>TIP:</i> When writing <i>windows applications</i> using NTL
346(as opposed to <i>console applications</i>) you might want to compile
347your program with the <tt>NTL_NO_MIN_MAX</tt> macro defined.
348This suppresses  the declaration of several <tt>min</tt>
349and <tt>max</tt> functions in file <tt>tools.h</tt> that conflict
350with macro names in the MFC header files.
351Do not attempt to build the library with this macro defined -- only
352programs that use the library.
353
354<p>
355NTL has been successfully installed and tested
356on Windows 95 platforms with both the
357Microsoft and Borland compilers.
358
359<p>
360If you have installed the Unix tools from
361<a href="http://www.cygnus.com">Cygnus</a>, then you can use the
362<a href="tour-unix.html">Unix</a> distribution of NTL.
363This distribution has been specially tailored to work smoothly
364with Cygnus tools.
365For many programmers,
366this is a much more comfortable and reliable program development environment
367than commercial systems like those from Microsoft and Borland.
368And moreover, these Unix tools are <i>free</i>.
369Of course, an even better approach is to install
370<a href="http://www.linux.org">Linux</a> on your PC.
371
372
373<p>
374
375<center>
376<a href="tour-unix.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a>
377 <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> 
378<a href="tour-tips.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a>
379</center>
380
381
382</body>
383</html>
Note: See TracBrowser for help on using the repository browser.