Главная » Просмотр файлов » Nash - Scientific Computing with PCs

Nash - Scientific Computing with PCs (523165), страница 23

Файл №523165 Nash - Scientific Computing with PCs (Nash - Scientific Computing with PCs) 23 страницаNash - Scientific Computing with PCs (523165) страница 232013-09-15СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 23)

This provides for a very succinct output that barely slows the program execution, yet itinforms the knowledgeable user what the program is doing. In most programming languages, display ofsingle characters need not force a linefeed, so very little screen or paper space is used to record quite alot of information, though such displays may confuse the uninitiated. We need a key to the significanceof the displayed characters or they are meaningless. Nevertheless, the technique is quick, easy to use andgives a rapid view of the relative usage of different parts of a program. The technique cannot be used ifthe display does not appear until a line is full, that is, until a buffer must be emptied.8.2SubstitutionsThe profile should tell us which parts of our calculation are "slow" so that we may consider what actionto take to achieve a speedup.

We consider the following possibilities:•Speeding up the overall operation of the program by use of a better translator for the programminglanguage;•Optimization or use of machine code for key segments of the program;•Use of additional processors in concert with the main processor.If we consider replacing our programming language compiler or interpreter, we need to be reasonablysure that the new version will be faster yet provide correct code.Table 8.2.1 Comparison of execution time on a 33 MHz 80386/80387 MS-DOS system for compilers andinterpreters using the simple program:40 FOR I=1 TO 1000050 LET X=EXP(SIN(COS(1!*I)))60 NEXT ICompiler or interpreterTime (seconds)Microsoft GWBASIC 3.23 interpreter(does not invoke 80387)26Microsoft QBASIC 1.0 interpretersuppressing 80387951Microsoft BASIC Compiler 6.0suppressing 80387550Microsoft Quick BASIC 4.00a5Borland Turbo BASIC 1.1suppressing 803873198: TIMING CONSIDERATIONS65Interpreters are like simultaneous translation at a meeting, converting source statements to machineinstructions on the fly, while compilers do the translation once and for all.

The situation is complicatedby the existence of interpreters that attempt to simplify the source code before execution. Keywords inthe source code can be reduced to 1-byte tokens. Some compilers partially process programs to anintermediate (possibly machine-independent) pseudo-machine code or p-code that may be interpreted orcompiled.

The UCSD Pascal system was a popular example of such a translator. The line between compilerand interpreter blurs with such practices. Typically, however, compilers provide significantly faster overallexecution speed than interpreters, though interpreted code has other advantages that may be importantin certain circumstances. The speedup will vary greatly depending on the type of operations. Testing andmeasurement (see Chapter 18) are the only way to know for sure.Assembly languages are tools for programming using the processor’s actual instruction set. Generally, thelarge number of details that need attention when programming at so low a level make this unattractivefor scientific computations, but the speedup may be worth the trouble.

We have found assembly coderoutines to be useful in only a few cases. For example, on a first-generation PC (Anderson and Nash, 1983)we were able to sort numbers approximately fifty times faster using 8080 assembly coded than withBASIC, the only other programming language available. A lot of human work was required to get thisimprovement, needed because the time delay in BASIC was unacceptable for the application, whichinvolved ranking sports tournament scores.We may sometimes be able to obtain fast assembly or machine-code routines from commercial or academicsources.

An example is found in the BLAS (Basic Linear Algebra Subprograms, Dongarra et al. 1979) thathave been optimized for many machines. Many common matrix algorithms have been specifically codedas calls to the BLAS to ensure reasonable efficiency over a wide class of computer systems. The BLAS hasbeen used as the basis for LINPACK (Dongarra et al 1979) and LAPACK (Anderson et al., 1992).8.3Special HardwareIf cost effective, consider adding extra hardware to increase throughput of data.

This may improveperformance with little human effort or intellectual energy. Special co-processors or ancillary circuit boardsallow functions such as Direct Memory Access input/output (DMA), disk operations, floating-pointarithmetic, or control functions to be performed very efficiently. Some examples are:•Special graphical display boards that have their own onboard processor to speed up display functions;•Disk doublers or data compression boards to provide fast but reliable enhanced data capacity;•Special numeric co-processors for vector or matrix functions;•Printer or communications buffers;•Caching disk controllers.The major concerns for the user in employing such add-ons are possible difficulties in installation and use.Co-processors designed to work with our existing system are usually easy to install.

While very earlysoftware for PCs was unable to take advantage of the Intel 8087, this void was soon filled. First dualversion products appeared like the Borland Turbo Pascal 3.01a compiler with TURBO.COM and TURBO87.COM. Most current software automatically detects the co-processor.

If it is not present it is emulatedby software, so results are (supposedly!) the same whether or not the co-processor is present, thoughcomputation time will generally be much longer without it. Some software requires a co-processor.The 80x87 family of numeric co-processors is popular because of the large base of existing PCs usingrelated 80x86 main processors, the high performance gain they give for low cost, and the conformance ofthese processors to a sensible standard for floating-point arithmetic (IEEE 754 April 1984). Consequently,there has been a demand for easy-to-use software to exploit these devices. The Motorola 6888xco-processors fulfil a similar role for the 680x0 main processors of Macintosh PCs and other machinesusing the 68000.66Copyright © 1984, 1994 J C & M M NashNash Information Services Inc., 1975 Bel Air Drive, Ottawa, ON K2C 0X1 CanadaSCIENTIFIC COMPUTING WITH PCsCopy for:Dr.

Dobb’s JournalManufacturers other than Intel and Motorola offer products that are replacements for the regularco-processor but claim better performance. They may offer better value for money, but timing tests areneeded to check claims. Since factors such as memory transfer speed may affect performance greatly, thetests need to be carried out on a variety of machines. We have seen one serious case of overheating in aco-processor, but floating-point is often a heavy power user and circuits run "hot".The speed of a co-processor should be matched to our system.

In 8088 / 8086 class machines, and 80386and later systems, the cycle speed for the co-processor is the same as for the main processor. This is notgenerally the case in 80286 machines. Our own 80286 machine uses a 12 MHz main processor but an 8MHz 80287. In reviewing some statistical software, we discovered an error that only occurred on such amachine. It did not occur when the 80287 was disabled. We believe that the C compiler used to create theprogram tried to optimize performance by running the 80286 and 80287 in parallel.

Since the 80286 runsfaster, it wins the race and causes an error (Nash J C, 1992).The devices just discussed are called co-processors. They execute commands that form a part of aninstruction-set for the computer architecture to which they belong. The floating-point instructions are"ignored" by the main processor; the co-processor executes them and returns results for use by laterinstructions. The main and co-processors act together as one CPU (central processing unit).

Somemicroprocessors, e.g., variants of the INMOS Transputer and the standard Intel 486 processor (but not the486SX), have floating-point instructions built in.Not all floating-point add-in hardware works as transparently as the devices just discussed. To obtainhigher performance on some special tasks such as inner-product accumulation(8.3.1)Inprod(x, y) =xi yiwe may choose to acquire a special-purpose "vector processor". To use such a device, however, we musttransfer data in and results out of it. These transfers must be very fast, or we will lose the advantages ofthe device’s speed of calculation. We will need special software, usually provided by the devicemanufacturer or related companies, but may have to write some machine or assembly code to maximizeperformance.8.4Disk Access TimesAny data processing job involves getting data in and out of memory.

In typing data at a keyboard thisis obvious, as is the delay loading data from any serial access media such as a tape. Disk operations, eventhose on high-performance fixed drives, take precious milliseconds. Attention to disk data transfers mayoffer ways to reduce such delays.Delays for transferring data from disk are made up of three parts:•Seek time — the time required to move the read/write head to the track to which data is to betransferred;•Latency time — the time for the disk to revolve until the data is under the head;•Start-up time — if the rotation motor is deactivated when the disk is inactive.

This is common forflexible disk drives, and is also used to save battery power for fixed disks on some portable PCs.The delays can sometimes be reduced by program modification. Start-up time may be avoided by callingfunctions to spin the disk in anticipation of data transfer. We have used the trick of executing a READor WRITE instruction that does not actually transfer any data. Similar tactics can be used sometimes topre-position the read/write head to save seek time.8: TIMING CONSIDERATIONS67A more general improvement can be obtained by using a disk cache.

Характеристики

Тип файла
PDF-файл
Размер
1,45 Mb
Тип материала
Учебное заведение
Неизвестно

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6314
Авторов
на СтудИзбе
311
Средний доход
с одного платного файла
Обучение Подробнее