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

scalacl fails on Math.sin #14

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

scalacl fails on Math.sin #14

ochafik opened this issue Mar 16, 2015 · 0 comments

Comments

@ochafik
Copy link
Member

ochafik commented Mar 16, 2015

From @julianrz on December 27, 2011 5:33

scalacl does not like full class names like Math.sin. (works when Math._ is imported). Error message is misleading...
scalac version is 2.9.1.final. scalac version is 0.2.final

import scalacl._
import scala.math._

object TestSin {
def main(args: Array[String]): Unit = {
implicit val context = Context.best // prefer CPUs ? use Context.best(CPU)
val rng = (1 until args.first.toInt).map(x=>x.toDouble).cl // transform the Range into a CLIntRange

val sumsin = rng.map(x=>Math.sin(x)).foldLeft(0.0)((a,b)=>a+b*b)
println("sum sin2(x)="+sumsin)

}
}

./scalac TestSin.scala

java.lang.RuntimeException: [ScalaCL] Unhandled method name in Scala -> OpenCL conversion : sin
left = scala.Math,
args = List(x)
at scalacl.plugin.OpenCLConverter$class.convert(OpenCLConverter.scala:201)
at scalacl.plugin.ScalaCLFunctionsTransformComponent.convert(ScalaCLFunctionsTransformComponent.scala:52)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.convertCode$1(ScalaCLFunctionsTransformComponent.scala:196)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1$$anonfun$4.apply(ScalaCLFunctionsTransformComponent.scala:201)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1$$anonfun$4.apply(ScalaCLFunctionsTransformComponent.scala:201)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
warning: [scalacl] TestSin.scala:10 An unexpected error occurred while attempting an optimization
[scalacl] TestSin.scala:10 Attempted optimization : 'associated equivalent OpenCL source to scalacl.CLArray[Double].map's function argument.'
[scalacl] TestSin.scala:10 You can skip this line with the following environment variable :
[scalacl] TestSin.scala:10 SCALACL_SKIP=TestSin.scala:10
[scalacl] TestSin.scala:10 Error : java.lang.RuntimeException: [ScalaCL] Unhandled method name in Scala -> OpenCL conversion : sin
[scalacl] TestSin.scala:10 left = scala.Math,
[scalacl] TestSin.scala:10 args = List(x)
[scalacl] TestSin.scala:10 An unexpected error occurred while attempting an optimization
[scalacl] TestSin.scala:10 Attempted optimization : 'associated equivalent OpenCL source to scalacl.CLArray[Double].map's function argument.'
[scalacl] TestSin.scala:10 You can skip this line with the following environment variable :
[scalacl] TestSin.scala:10 SCALACL_SKIP=TestSin.scala:10
[scalacl] TestSin.scala:10 Error : java.lang.RuntimeException: [ScalaCL] Unhandled method name in Scala -> OpenCL conversion : sin
[scalacl] TestSin.scala:10 left = scala.Math,
[scalacl] TestSin.scala:10 args = List(x)

Copied from original issue: nativelibs4java/nativelibs4java#219

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