Questions tagged [unroll]

27 questions
66
votes
3 answers

Tell gcc to specifically unroll a loop

How can I tell GCC to unroll a particular loop? I have used the CUDA SDK where loops can be unrolled manually using #pragma unroll. Is there a similar feature for gcc? I googled a bit but could not find anything.
Nils
  • 13,319
  • 19
  • 86
  • 108
17
votes
2 answers

Unlist a data frame by rows, not columns

A relatively simple question, but the answer seems to have eluded me. Currently, I have a data frame which looks similar to this: 0 0 0 1 1 0 1 0 1 1 2 1 1 0 3 I'm trying to turn this into a single line of data, by rows. I…
Gio Circo
  • 332
  • 2
  • 9
16
votes
2 answers

Can scala splat be used for anything that isn't a varargs?

given e.g: scala> def pipes(strings:String*) = strings.toList.mkString("|") which I can call normally: scala> pipes("foo", "bar") res1: String = foo|bar or with a splat: scala> val args = List("a","b","c") scala> pipes(args:_*) res2: String =…
gfxmonk
  • 8,614
  • 5
  • 42
  • 53
11
votes
1 answer

Why does the performance of my #pragma-unrolled loop degrade if the trip count is not constant?

I have following code using loop unrolling: #pragma unroll for (int i=0;i
small_potato
  • 3,127
  • 5
  • 39
  • 45
8
votes
1 answer

Does gcc automatically "unroll" if-statements?

Say I have a loop that looks like this: for(int i = 0; i < 10000; i++) { /* Do something computationally expensive */ if (i < 200 && !(i%20)) { /* Do something else */ } } wherein some trivial task gets stuck behind an…
rayhem
  • 741
  • 1
  • 8
  • 23
5
votes
1 answer

How can I prevent a (serialized) expression to unroll

Thanks to the PowerShell expression mode, PowerShell has some nice ways to de-serialize objects, like: the Invoke-Expression cmdlet the Invoke-Command cmdlet the call operator & dot sourcing a PowerShell script file My general expectation is that…
iRon
  • 20,463
  • 10
  • 53
  • 79
5
votes
1 answer

Add method call in test name with Unroll using Spock

I have a code and I want to put method invocation value in the name of the method. @Unroll def 'check #file other text'() { setup: def file = allProperties.keySet().getAt(0) ... where: ... Now…
Xelian
  • 16,680
  • 25
  • 99
  • 152
3
votes
0 answers

Specific case of unrolling an array to a function with arbitrary number and type of arguments

Important! Existing answers imply that all function parameter types are the same, only the number of parameters varies. For instance : Any Solution to Unpack a Vector to Function Arguments in C++? It's not possible to use return func(args[I]...)…
galinette
  • 8,896
  • 2
  • 36
  • 87
3
votes
1 answer

Is there any difference between #pragma unroll(0) and #pragma unroll(1)?

I read the document about the loop unrolling. It explains that if you set unrolling factor as 1, then the program will work like with #pragma nounrolling. However, that documents does not include #pragma unroll(0) case.. Since the range of n is 0 to…
2
votes
2 answers

symbolic simulation in c c++

I am wondering if i could see the loop unrolled form of a C program. For example i have the following for loop // The following code mimics functionality of a logic circuit whose //inputs are a,b,c and d //output f //At every for loop iteration,…
user2065276
  • 313
  • 2
  • 16
1
vote
1 answer

Spring-Boot and Spock fail when using Unroll

I'm setting up a demo project with Spring-Boot. For entity-persistence, I'm using Spring generated Repository implementations based on interfaces: @Repository public interface MovieRepository extends JpaRepository { List
BramP
  • 51
  • 6
1
vote
6 answers

Efficient by-hand loop unrolling

I have this C code: for (k = 0; k < n_n; k++) { if (k == i || k == j) continue; dd=q2_vect[k]-q1_vect; d2=dd*dd; if (d2<0) { a=1; break; } } For compiler optimization reasons (on the SPE of the Cell…
Open the way
  • 26,225
  • 51
  • 142
  • 196
1
vote
1 answer

how unroll a matrix in R

For example, I have a matrix: [,1] [,2] [,3] [,4] [1,] 1 2 3 4 [2,] 5 6 7 8 [3,] 9 10 11 12 [4,] 13 14 15 16 I want it to become [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1 2 3 4 …
Frank
  • 7,235
  • 9
  • 46
  • 56
1
vote
1 answer

Unrolled linked list arrays vs. nodes

I'm reading about unrolled linked lists and have found two different ways to make one. The book I have implements one like this: // Node typedef struct node { int data; struct node *next; } Node; // Block of nodes typedef struct linkedblock…
Austin
  • 6,921
  • 12
  • 73
  • 138
1
vote
1 answer

How to unroll a certain loop with certain params like max-unroll-times in GCC

How should I write my code if I want GCC to unroll one of loops in my code with certain params like max-unroll-times in GCC?
zbhhbz
  • 19
  • 2
1
2