Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScalaCLPlugin : tuple assignment in deconstructive assignment appears to be broken #12

Open
ochafik opened this issue Mar 16, 2015 · 0 comments
Assignees

Comments

@ochafik
Copy link
Member

ochafik commented Mar 16, 2015

From @ochafik on September 1, 2011 18:35

The pair @ alias is not properly handled anymore :
{{{
// mvn compile scala:run -DmainClass=scalacl.plugin.Compile "-DaddArgs=Test.scala|-cp|../ScalaCL/target/scalacl-0.3-SNAPSHOT-shaded.jar"
object Test {
import scalacl._
import scala.math._
implicit val context = Context.best
// prefer CPUs ? Context.best(CPU)
val array = (100 until 300).cl

val r2 =
array.map(v => {

def someFun(x: Int) = // becomes a top-level function inside the OpenCL kernel
  exp(x / 1000).toInt

val pair @ (init, foo) = { // tuples will be flattened in the OpenCL kernel
   val d = v - 10     // unless they match an OpenCL tuple type like int2
   (d * d, 1 / d)
}
var sum = init + 1.0
for (i <- 0 until 10; if (i % 2) != 0) {
   sum += cos(v) * i + someFun(pair._2 - foo)
}
(sum, foo)

})
println(r2)
}
}}}

Google Code Info:
Issue #: 78
Author: olivier.chafik
Created On: 2011-07-15T00:41:35.000Z
Closed On:

Copied from original issue: nativelibs4java/nativelibs4java#80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant