# SetOptions in parallel computation

I have NIntegrate[] inside a ParallelDo[] loop. Outside the loop I set some options for the integration using SetOptions[].

To give an example:

SetOptions[NIntegrate, MaxRecursion -> 20];
ParallelDo[NIntegrate[Cos[20000 x]/Sqrt[x], {x, 0, 1}], {i, 1, 4}]


results in the error output

NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {0.}. NIntegrate obtained 0.005799163549191785 and 0.014875547652988553 for the integral and error estimates.


Thus, not every kernel seems to know about the set options. How to distribute this setting over every kernel?

Use ParallelEvaluate to make sure that SetOptions is evaluated by each kernel:
ParallelEvaluate[SetOptions[NIntegrate, MaxRecursion -> 20]];