Sun Nov 19 22:52:22 1995 Connection MachineLinking...done. : 2.1 Source Rev: f2100 page: 1 Source Listing File: /scratch2/hanson/pgm.fcm 1 1 0 C primes1.fcm: Simple Program modified from CMF Programming Guide, Ch. 11 2 2 0 C PARALLEL VERSION: Compile using CM Fortran version 0.7 or later 3 3 0 4 4 0 C This first version is a straightforward translation of the serial 5 5 0 C version. Though it is much faster than the serial version, it is 6 6 0 C not the fastest implementation. 7 7 0 8 8 0 PROGRAM findPrimes 9 9 0 IMPLICIT NONE 10 10 0 INTEGER i, n, nextPrime 11 11 0 PARAMETER (n = 999) 12 12 0 LOGICAL PRIMES(n), CANDID(n) 13 13 0 comment: Need to include CMF timer utilities: 14 14 0 include'/usr/include/cm/timer-fort.h' 15 15 0 comment: Clear and start timer 0. 30 16 0 call cm_timer_clear(0) 31 17 0 call cm_timer_start(0) 32 18 0 C 33 19 0 C Initialization 34 20 0 C 35 21 0 PRIMES = .FALSE. 36 22 0 CANDID = .TRUE. 37 23 0 CANDID(1) = .FALSE. 38 24 0 C 39 25 0 C Loop: Find next valid candidate, mark it as prime, 40 26 0 C invalidate all multiples as candidates, repeat. 41 27 0 C 42 28 0 nextPrime = 2 43 29 0 DO WHILE (nextPrime .LE. SQRT(REAL(n))) 44 30 0 PRIMES(nextPrime) = .TRUE. 45 31 0 CANDID(nextPrime:n:nextPrime) = .FALSE. 46 32 0 nextPrime = MINVAL([1:n], dim=1, mask=CANDID) 47 33 0 END DO 48 34 0 C 49 35 0 C At this point, all valid candidates are prime 50 36 0 C 51 37 0 PRIMES(nextPrime:n) = CANDID(nextPrime:n) 52 38 0 comment: Stop and Print timer 53 39 0 call cm_timer_stop(0) 54 40 0 print*,'total CM5 time' 55 41 0 call cm_timer_print(0) 56 42 0 C 57 43 0 C Print results 58 44 0 C 59 45 0 PRINT *, "Number of primes:", COUNT(PRIMES) 60 46 0 DO i=1, n 61 47 0 IF (PRIMES(i)) PRINT *, i 62 48 0 ENDDO 63 49 0 STOP Sun Nov 19 22:52:22 1995 Connection Machine Fortran Version: 2.1 Source Rev: f2100 page: 2 Symbol Storage Map File: /scratch2/hanson/pgm.fcm ENTRY POINTS Offset Type Name 0 NONE FINDPRIMES STORAGE BLOCKS Size Block 8000 local 111 constants VARIABLES Offset Size Type Block Name 0 4 INT4 local FE I 4 4 INT4 local FE NEXTPRIME --- 0 NONE global FE _cmpe_findprimes_0 --- 0 NONE global FE _cmpe_findprimes_0_ --- 0 NONE global FE _cmpe_findprimes_1 --- 0 NONE global FE _cmpe_findprimes_1_ --- 0 NONE global FE _cmpe_findprimes_2 --- 0 NONE global FE _cmpe_findprimes_2_ --- 0 NONE global FE _cmpe_findprimes_3 --- 0 NONE global FE _cmpe_findprimes_3_ --- 0 NONE not-referenced FE findprimes ARRAYS Offset Size Type Block/Class Home Name 4004 3996 LOG4 local CM CANDID 8 3996 LOG4 local CM PRIMES PARAMETERS (Offset is within Storage Block 'constants') Offset Type Name Value 0 INT4 N 999 0 INT4 _DOUBLE_ 64 0 INT4 _DOUBLE_COMPLEX_ 64 0 INT4 _DOUBLE_INT_ 64 0 INT4 _SINGLE_ 32 0 INT4 _SINGLE_COMPLEX_ 32 0 INT4 _SINGLE_INT_ 32 INTRINSIC PROCEDURES Name COUNT MINVAL REAL SQRT STATEMENT FUNCTIONS Type Name Sun Nov 19 22:52:22 1995 Connection Machine Fortran Version: 2.1 Source Rev: f2100 page: 3 Symbol Storage Map File: /scratch2/hanson/pgm.fcm EXTERNALS Type Unit_Kind Name INT4 function CM_NUMBER_OF_TIMERS NONE subroutine CM_TIMER_CLEAR NONE subroutine CM_TIMER_PRINT REAL8 function CM_TIMER_READ_CM_BUSY REAL8 function CM_TIMER_READ_CM_IDLE REAL8 function CM_TIMER_READ_ELAPSED INT4 function CM_TIMER_READ_RUN_STATE INT4 function CM_TIMER_READ_STARTS NONE subroutine CM_TIMER_START NONE subroutine CM_TIMER_STOP NAME LISTS Name CONSTRUCT NAMES Name COMMUNICATION ROUTINES Name Line Number (number of times) READ VALUE FROM PROCESSOR 47 MINVAL (into scalar) 32 COUNT (into scalar) 45 Sun Nov 19 22:52:22 1995 Connection Machine Fortran Version: 2.1 Source Rev: f2100 page: 4 Source Listing File: /scratch2/hanson/pgm.fcm Sun Nov 19 22:52:22 1995 Connection Machine Fortran Version: 2.1 Source Rev: f2100 page: 5 Utility Stats Input File: /scratch2/hanson/pgm.fcm Base File: pgm COMMAND QUALIFIERS -optimize -dp -list pgm.fcm analysis_data check = (no bounds,overflow,no underflow ) continuations = 19 directives f77 i4 ifconvert level_of_vectorization = 100 list machine_code optimize = (local,global,code_motion ) overlap show = (no dictionary,no include,no map,no preprocessor,no single ) standard = (no syntax,no source,no semantic ) v104 warnings = (no declarations,general,no ultrix,no vaxeln ) postoptimize preoptimize loadstoremotion ucephase uaephase prcphase prsphase ucepost uaepost prcpost prspost cppost complex_lower safety = 0 pnodes = -1 peephole axisreorder loopreversal dp trcback skip_garbage newforall killuselessalloc new_modifies prc2 prs2 redo_modifies defer_modifies comb_cp source_fc source_node const transp cp_last bb_merge meoptimize mecopypropagate memergetemps merepl menullallcntx mesgsize = 10000 merge amode single_complex_opt prover = () peschedule peschalias pe_asm_machine_code pe_asm_comments pe_asm_srclines