<p>In GPU scrypt mining, the optimized threshold of lookup gap is 2. It means the GPU only saves 0, 2, 4, ..., etc to GDDR (global memory of GPU) and reduce huge amount of time of saving all 128KB data for one scrypt calculation. However, it needs some GPU cycles to re-compute for the elements if the algorithm needs data in the index of 1, 3, 5, ... And remixing those 1024 elements also takes GPU cycles. In the GPU architecture, the hardware scheduler will help to hide the latency of memory read/write. So, the GPU cycles are not wasted.
One of the inefficient part is the parallelized processing with conditional code. For a wave-front or stream processor to compute n-dimension at once, not every core needs and computes the values of odd index of elements. So some cores must be masked as off and they are wasted.</p>

<pre><code>if (j &amp; 1)
    salsa(...);
</code></pre>

<p>When GPU computes <code>N</code> elements at once, then every variable <code>j</code> of different thread could be even or odd. So only the thread which has odd number in <code>j</code> needs to run the code <code>salsa</code> first. There is only one shared program counter in the compute unit, so every thread runs the same code. But for those threads that don't need the to do <code>salsa</code> agin, those processors are being masked off like they are not running and compute the code.</p>

<p>So, in the GPU programming manual, it tells you the following is inefficient.</p>

<pre><code>if (A)
    B = 0;
else
    B = 1;
</code></pre>

<p>Then the GPU needs to run the code twice. One is for the true condition and another is for the false condition.</p>

<p>It's better to re-write the code as follows.</p>

<pre><code>B = A ? 0 : 1;
</code></pre>

<p>However, in scrypt, salsa is not a simple expression can do like this way.</p>

CC BY-SA 3.0
2014-08-21T00:14:04.973Z
This is an interesting analysis, but for a non-expert, it would be helpful to have a bottom line: is this possible, and, in simple terms, why or why not?
Nate Eldredge
CC BY-SA 3.0
2014-04-22T03:25:27.493Z
2014-04-22T03:25:27.493Z
jclin
<p>Is it possible to mine scrypt and sha256 coins at the same time on one GPU?</p>

<p>Rationale: Hashrate of scrypt mining is limited by memory bandwidth. That means that some of the processor cycles are wasted because the processors are waiting data from RAM. These wasted processor cycles could be used insted for sha256 mining which needs much less bandwidth.</p>

CC BY-SA 3.0
2014-02-21T04:23:52.550Z
Same could be asked of mixing scrypt-mining and either scrypt-n (as in vertcoin) or scrypt-jane at the same time on the same GPU. My guess it won't be very profitable...
Joe Pineda
<gpu-mining>
Combined scrypt/SHA256 mining on one GPU
SmallMiner
# Combined scrypt/SHA256 mining on one GPU

(Asked by: username_0 on 2013-06-04)

Is it possible to mine scrypt and sha256 coins at the same time on one GPU?

Rationale: Hashrate of scrypt mining is limited by memory bandwidth. That means that some of the processor cycles are wasted because the processors are waiting data from RAM. These wasted processor cycles could be used insted for sha256 mining which needs much less bandwidth.

**Tags:** gpu-mining

> **Comments:**
> **username_1**: Same could be asked of mixing scrypt-mining and either scrypt-n (as in vertcoin) or scrypt-jane at the same time on the same GPU. My guess it won't be very profitable...  

---

## 1 answers

### Answer by username_2 on 2014-04-22. Score: 1

In GPU scrypt mining, the optimized threshold of lookup gap is 2. It means the GPU only saves 0, 2, 4, ..., etc to GDDR (global memory of GPU) and reduce huge amount of time of saving all 128KB data for one scrypt calculation. However, it needs some GPU cycles to re-compute for the elements if the algorithm needs data in the index of 1, 3, 5, ... And remixing those 1024 elements also takes GPU cycles. In the GPU architecture, the hardware scheduler will help to hide the latency of memory read/write. So, the GPU cycles are not wasted.
One of the inefficient part is the parallelized processing with conditional code. For a wave-front or stream processor to compute n-dimension at once, not every core needs and computes the values of odd index of elements. So some cores must be masked as off and they are wasted.

```
if (j & 1)
    salsa(...);

```

When GPU computes `N` elements at once, then every variable `j` of different thread could be even or odd. So only the thread which has odd number in `j` needs to run the code `salsa` first. There is only one shared program counter in the compute unit, so every thread runs the same code. But for those threads that don't need the to do `salsa` agin, those processors are being masked off like they are not running and compute the code.

So, in the GPU programming manual, it tells you the following is inefficient.

```
if (A)
    B = 0;
else
    B = 1;

```

Then the GPU needs to run the code twice. One is for the true condition and another is for the false condition.

It's better to re-write the code as follows.

```
B = A ? 0 : 1;

```

However, in scrypt, salsa is not a simple expression can do like this way.

> **Comments:**
> **username_3**: This is an interesting analysis, but for a non-expert, it would be helpful to have a bottom line: is this possible, and, in simple terms, why or why not?  

---

