- Timestamp:
- Mar 30, 2023, 4:01:44 PM (17 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- d24b1985
- Parents:
- 76a8400
- Location:
- doc/theses/colby_parsons_MMAth/benchmarks/channels/go
- Files:
-
- 13 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/colby_parsons_MMAth/benchmarks/channels/go/contend/contend.go
r76a8400 re2f827f 64 64 case 3: 65 65 if os.Args[2] != "d" { // default ? 66 ChannelSize, _ = strconv.Atoi( os.Args[ 1] )66 ChannelSize, _ = strconv.Atoi( os.Args[2] ) 67 67 if ChannelSize < 0 { usage(); } 68 68 } // if … … 78 78 } // switch 79 79 runtime.GOMAXPROCS( Processors ); 80 ProdsPerChan = Processors 81 ConsPerChan = Processors 80 ProdsPerChan = Processors /2 81 ConsPerChan = Processors / 2 82 82 83 83 // fmt.Println("Processors: ",Processors," Channels: ",Channels," ProdsPerChan: ",ProdsPerChan," ConsPerChan: ",ConsPerChan," Channel Size: ",ChannelSize) … … 108 108 cons_done = true 109 109 for i := range chans { 110 J: for j := 0; j < ConsPerChan; j++{110 L: for { 111 111 select { 112 case chans[i] <- 0:113 112 case k := <-chans[i]: 113 cons_check = cons_check ^ k 114 114 default: 115 break J115 break L 116 116 } 117 117 } 118 118 } 119 for i := range chans { 120 close(chans[i]) 121 } 122 119 123 for j := 0; j < ConsPerChan * Channels; j++{ 120 124 <-consJoin 121 125 } 122 126 123 // for i := range chans { 124 // L: for { 125 // select { 126 // case k := <-chans[i]: 127 // cons_check = cons_check ^ k 128 // default: 129 // break L 130 // } 131 // } 132 // } 127 133 128 if cons_check != prod_check { 134 129 fmt.Println("\nChecksum mismatch: Cons: %d, Prods: %d", cons_check, prod_check) 135 130 } 136 for i := range chans {137 close(chans[i])138 }139 131 fmt.Println(total_operations) 140 132 }
Note: See TracChangeset
for help on using the changeset viewer.