Permutation-stream based n-queens solution
Variable Names

There is little reason not to give the variables clear meaningful names. Using abbreviations leads to using bd in check-diagonals and brd in the search loop. Calling the board board makes the code clearer. Similarly, the time a reader spends figuring out that r1 and r2 refer to rows is wasted time for every reader. It saved the programmer four keypresses once. 

The size of the board is a natural number. The traditional notation for the Natural Numbers is n not N. It's why it's the 'n-queens' problem not the 'N-queens' problem.

Concurrency and Parallelization

Concurrency covers all problems where the execution can be logically simultaneous whether or not the implementation runs in parallel or not. Most concurrent processes do not run entirely in parallel. Parallelization is a way of executing a concurrent process. All concurrent processes are not run in parallel. All parallel processes are logically concurrent.

The n-queens problem

The solution space of n-queens problem is non-polynomial. The size is n!. Parallelization with p nodes still leaves the solution space non-polynomial, approximately n!/p. A solution that would take a 100 million years still takes an impractical time when spread across 1,000,000 nodes.

What makes the n-queens problem interesting is that it is non-polynomial and that it has symmetries that allow for the search space to be pruned.  For example, many configrations are isomorphically related to  other configurations by board rotation and mirroring.

Optimizing solutions to NP problems

There is no general algorithm for quickly solving non-polynomial problems. That's what makes them interesting/hard depending on one's perspective. Speeding up the code to a specific problem requires taking advantage of the problem specifics. 

In the case of n-queens, pruning the search space of isomorphic non-solutions each time a non-solution is found. Optimization comes from writing code that coming across the the n=3 non-solution: 

  a b c
1 Q Q
2
3


prunes the search space of isomorphic configurations such as:

  a b c
1   Q Q
2
3


and

  a b c
1     Q
2     Q
3


Other Strategies

An empty board has zero probability of being a solution. This is lower than a board with a queen randomly placed in each column. Though the probability of random placement producing a solution is slight, it is better than an empty board.

Gradient Descent Starting with a randomly populated board, an estimate of the distance from a solution is made. [1] Next each alternative position for each queen is examined and an estimate of the distance from a solution is made for each resulting configuration. The one move that results in minimizing the distance from the solution is made and the process repeats.

When no improvement is possible the solution may be abandoned [2] and a new random board generated. Generating and examining random boards is parallizable and typically done because the number of boards examined is often large.

[1]: Choosing how to measure the distance is art informed by science, not pure science except in so far as recognizing that the problem of measuring is still in NP.

[2]: More complex approaches may not always chose the configuration closest to a solution and/or backtrack when no improvement is possible. Again, optimization is based on understanding the particulars of the problem.