Skip to content

parameters require shared for atomic operations in 2.058 #1

Open
@jnorwood

Description

@jnorwood

I found it necessary to add shared to a few parameters in your parallel_algorithm to get it to build on 2.058 on win7-64.

G:\d\p_algorithm\parallel_algorithm>git diff
diff --git a/parallel_algorithm.d b/parallel_algorithm.d
index 7b7f5cc..38de9a2 100644
--- a/parallel_algorithm.d
+++ b/parallel_algorithm.d
@@ -627,8 +627,8 @@ hasLength!R1 && hasLength!R2) {
assert(chunks1.length == chunks2.length);
immutable nChunks = chunks1.length;

  • bool ret = true;
  • size_t currentChunkIndex = size_t.max;
  • shared bool ret = true;
  • shared size_t currentChunkIndex = size_t.max;

foreach(threadId; parallel(iota(nThreads), 1)) {

@@ -752,7 +752,7 @@ Range parallelFind(alias pred, Range)(
} while(!cas(&minHitIndex, old, newIndex));
}

  • size_t sliceIndex = size_t.max;
  • shared size_t sliceIndex = size_t.max;

foreach(threadId; parallel(iota(nThreads), 1)) {

@@ -873,7 +873,7 @@ template arrayOpImpl(ops...) {
) if(Operands.length >= 2) {
if(pool is null) pool = taskPool;
immutable nThread = pool.size + 1;

  •    size_t workUnitIndex = size_t.max;
    
  •    shared size_t workUnitIndex = size_t.max;
    
     foreach(thread; parallel(iota(nThread), 1)) {
         while(true) {
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions