I am trying to build the openblas.bb in a yocto project but it fails.
machine is "qemux86-64"
DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version."
SUMMARY = "OpenBLAS : An optimized BLAS library"
AUTHOR = "Alexander Leiva <norxander#gmail.com>"
HOMEPAGE = "http://www.openblas.net/"
LICENSE = "BSD-3-Clause"
DEPENDS = "make libgfortran"
RDEPENDS_${PN} = "libgfortran"
LIC_FILES_CHKSUM = "file://LICENSE;md5=5adf4792c949a00013ce25d476a2abc0"
PV = "0.3.16"
SRC_URI = "git://github.com/xianyi/OpenBLAS.git;protocol=https;branch=release-0.3.0"
SRCREV = "fab746240cc7e95569fde23af8942f8bc97d6d40"
S = "${WORKDIR}/git"
def map_arch(a, d):
import re
if re.match('i.86$', a): return 'ATOM'
elif re.match('x86_64$', a): return 'ATOM'
elif re.match('aarch32$', a): return 'CORTEXA9'
elif re.match('aarch64$', a): return 'ARMV8'
elif re.match('arm$', a): return 'ARMV7'
return a
def map_bits(a, d):
import re
if re.match('i.86$', a): return 32
elif re.match('x86_64$', a): return 64
elif re.match('aarch32$', a): return 32
elif re.match('aarch64$', a): return 64
elif re.match('arm$', a): return 32
return 32
def map_extra_options(a, d):
import re
if re.match('arm$', a): return '-mfpu=neon-vfpv4 -mfloat-abi=hard'
return ''
do_compile () {
oe_runmake HOSTCC="${BUILD_CC}" \
CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${#map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
CF="${TARGET_PREFIX}gfortran ${TOOLCHAIN_OPTIONS} ${#map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
PREFIX=${exec_prefix} \
CROSS_SUFFIX=${HOST_PREFIX} \
BINARY='${#map_bits(d.getVar('TARGET_ARCH'), d)}' \
TARGET='${#map_arch(d.getVar('TARGET_ARCH'), d)}'
}
do_install() {
oe_runmake HOSTCC="${BUILD_CC}" \
CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" \
PREFIX=${exec_prefix} \
CROSS_SUFFIX=${HOST_PREFIX} \
BINARY='${#map_bits(d.getVar('TARGET_ARCH'), d)}' \
TARGET='${#map_arch(d.getVar('TARGET_ARCH'), d)}' \
DESTDIR=${D} \
install
}
FILES_${PN}-dev = "${includedir}/* ${libdir}/lib${PN}.so* ${libdir}/lib${PN}*.a ${libdir}/cmake ${libdir}/pkgconfig"
FILES_${PN} = "${bindir} ${libdir}/lib${PN}*.so"
and here some from the log.do_compile file:
**
| OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat1
| /bin/sh: 1: ./sblat1: not found
| Makefile:28: recipe for target 'level1' failed
| make[1]: *** [level1] Error 127
| make[1]: *** Waiting for unfinished jobs....
| make[1]: Leaving directory '/path/yocto_project/update-desktop-bsp/build/tmp/work/core2-64-poky-linux/openblas/0.3.16-r0/git/test'
| Makefile:145: recipe for target 'tests' failed
| make: *** [tests] Error 2
| WARNING: exit code 1 from a shell command.
ERROR: Task (/path/yocto_project/update-desktop-bsp/layers/meta-ammsc2/recipes-math/openblas/openblas.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 516 tasks of which 509 didn't need to be rerun and 1 failed.
**
I changed to use the newest version of the openblas:
PV = "0.3.18"
also I set the CROSS argument to 1 in do_compile :
do_compile () {
oe_runmake HOSTCC="${BUILD_CC}" \
CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${#map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
CF="${TARGET_PREFIX}gfortran ${TOOLCHAIN_OPTIONS} ${#map_extra_options(d.getVar('TARGET_ARCH'), d)}" \
PREFIX=${exec_prefix} \
CROSS_SUFFIX=${HOST_PREFIX} \
CROSS=1 \
BINARY='${#map_bits(d.getVar('TARGET_ARCH'), d)}' \
TARGET='${#map_arch(d.getVar('TARGET_ARCH'), d)}'
}
Related
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import pytest
def test_google():
serv_obj = Service(r"path of chrome")
driver = webdriver.Chrome(service=serv_obj)
driver.get("https://www.google.com/")
assert driver.title=="Google"
driver.quit()
def test_naukri():
serv_obj = Service(r"path of chrome")
driver = webdriver.Chrome(service=serv_obj)
driver.get("https://www.naukri.com/mnjuser/homepage")
assert driver.title=="Jobseeker's Login: Search the Best Jobs available in India & Abroad - Naukri.com"
driver.quit()
def test_gmail():
serv_obj = Service(r"path of chrome")
driver = webdriver.Chrome(service=serv_obj)
driver.get("https://mail.google.com/mail/u/0/#inbox")
assert driver.title=="Gmail"
driver.quit()
def test_instagram():
serv_obj = Service(r"path of chrome")
driver = webdriver.Chrome(service=serv_obj)
driver.get("https://www.instagram.com/")
assert driver.title=="Instagram"
driver.quit()
**
#this is my code, when i tried to parallel execution 'pytest My_directory/test_title.py -n 4', it gives error:
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n 4
inifile: C:\path\pytest.ini
rootdir: C:\path\pythonProject\Pytest_Practice**
I want to execute a following script using Scala3:
#main def m() =
println("Hello, world! I'm a script")
When I type the command, scala hello.scala, I get the following error:
/Users/avirals/dev/learning-scala/hello-world/hello.scala:1: error: not found: type main
#main def m() =
^
one error found
I think it is because I have both the versions of Scala installed (2 and 3). I know how to start a REPL for both (as mentioned here) but I am not able to execute a Scala3 script from the command line.
[Update]
I tried scala3-repl hello.scala and it just opens the REPL:
➜ learning-scala git:(main) scala3-repl hello.scala
scala> m()
1 |m()
|^
|Not found: m
How do I execute a Scala 3 script from the command line given I have two different versions (2 and 3) of Scala installed?
My OS: MacOS
Update 2
As suggested in this answer, I tried running with amm and it worked for a few scripts. However, the following script failed:
Script:
#main def m(args: String*) =
var i = 0
while i < args.length do
println(args(i))
i += 1
Error:
➜ learning-scala git:(main) amm printargs.scala
printargs.scala:2:3 expected (If | While | Try | DoWhile | For | Throw | Return | ImplicitLambda | SmallerExprOrLambda)
var i = 0
^
Running the above script in a Scala3-REPL works:
➜ learning-scala git:(main) scala3-repl
scala> #main def m(args: String*) =
| var i = 0
| while i < args.length do
| println(args(i))
| i += 1
|
def m(args: String*): Unit
scala> m("aviral", "srivastava")
aviral
srivastava
Running the same script in a system (MacOS) that has only Scala3 installed works just fine as well.
There exists currently Minimal scripting support #11379. I was able to get it working by manually downloading a release from https://github.com/lampepfl/dotty/releases/download/3.0.0-RC3/scala3-3.0.0-RC3.zip, unzipping, and giving executable permission to launchers
./scala3-3.0.0-RC3/bin/scala hello.scala
Hello, world! I'm a script
With scala3-repl launcher you could at least do
$ scala3-repl
scala> :load hello.scala
def m(): Unit
scala> m()
Hello, world! I'm a script
I am sending this json to my scala code but I am getting error `` when the json is getting parsed.
{"practice-question":{"title":"dummy title","description":"<p>some D</p><p><strong>with bold</strong></p><ol><li><strong>no 1</strong></li></ol>","tags":["javascript"],"references":["dummy references"],"hints":["<p><u>some hint</u></p>"],"image":["data:image/png;base64,iVBORw0],"answer":[{"filename":"c.js","answer":"function c(){\n c;\n}"}],"success-test":"dummy success test","fail-test":"dummy fail test"}}))
The json validation starts at
val questionOption = jsonBody.validateOpt[Question] //should give JsSuccess or JsError
It should call the following Reads
implicit val questionReads:Reads[Question] = (JsPath \ "practice-question").read[PracticeQuestion](PracticeQuestionReads)
.map((x:PracticeQuestion)=>Question.apply (x))
The Reads for PracticeQuestion is
implicit object PracticeQuestionReads extends Reads[PracticeQuestion] {
def reads(json:JsValue):JsResult[PracticeQuestion] = {
println(s"validating json ${json}")
val structurallyValidated = json.validateOpt[PracticeQuestion](practiceQuestionValidateStructureReads) //check that structurally the json maps to PracticeQuestion
println(s"structurally validated ${structurallyValidated}")
val structuralValidationResult = structurallyValidated match {
case JsSuccess(questionOpt,path)=>{
val result = questionOpt.map(question=>{
//TODOM - should check size of other lists (hints, references etc.)
if(question.image.length <0 || question.image.length > 3)
{
JsError("invalid no. of images")
}
else {
JsSuccess(question)
}
}).getOrElse(JsError("Error in validating Json"))
result
}
case JsError(errors) =>{
//TODOM - replace print with logger.
println("errors in json structure: "+errors)
JsError(errors)
}
}
structuralValidationResult match {
case JsSuccess(question,path)=>{
//TODOM - check that for other mandatory fields (esp in Lists)are not empty
if(question.answer.length == 0){
JsError("Missing Answer")
} else {
JsSuccess(question);
}
}
case JsError(errors) =>{
JsError(errors)
}
}
}
}
and Reads used in PracticeQuestionReads is
implicit val practiceQuestionValidateStructureReads: Reads[PracticeQuestion] = {
println("in conversion");
val p = //p is of type FunctionBuilder[Reads]#CanBuild. This is an intermediary object used to create Reads[PracticeQuestion].
(JsPath \ "question-id").readNullable[UUID] and
(JsPath \ "description").read[String] and
(JsPath \ "hints").read[List[String]] and
(JsPath \ "image").read[List[String]] and //while image data is optional, this field is always present i.e. will get at least image:[]
(JsPath \ "success-test").read[String] and
(JsPath \ "fail-test").read[String] and
(JsPath \ "tags").read[Set[String]] and
(JsPath \ "title").read[String] and
(JsPath \ "answer").read[List[AnswerSection]] and
(JsPath \ "references").read[List[String]] and
(JsPath \ "question-creator").readNullable[QuestionCreator] and
(JsPath \ "creation-year").readNullable[Long] and //year/month are for internal consumption so not worried about receiving it from a client
(JsPath \ "creation-month").readNullable[Long] and
(JsPath \ "creation-hour").readNullable[Long] and
(JsPath \ "creation-minute").readNullable[Long]
//apply method of CanBuildX with a function to translate individual values to your model, this will return your complex Reads
val q = p.apply((PracticeQuestion.apply _))
q
}
To me the structure etc. look ok. What am I doing wrong?
UPDATE, after two months, the error occurred but for a different. I am running a test and am sending a json from the test. The error is
Uninitialized field: C:\Users\manuc\Documents\manu\codingjedi\code_related\code\frontend\web\app\controllers\AnswerController.scala: 34
scala.UninitializedFieldError: Uninitialized field: C:\Users\manuc\Documents\manu\codingjedi\code_related\code\frontend\web\app\controllers\AnswerController.scala: 34
at controllers.AnswerController.logger(AnswerController.scala:34)
at controllers.AnswerController.$anonfun$maxAllowedBodySize$1(AnswerController.scala:33)
at scala.runtime.java8.JFunction0$mcJ$sp.apply(JFunction0$mcJ$sp.java:12)
at scala.Option.getOrElse(Option.scala:121)
at controllers.AnswerController.<init>(AnswerController.scala:33)
at UnitSpecs.ControllerSpecs.AnswerControllerSpecTestEnv.<init>(AnswerControllerSpecTestEnv.scala:98)
at UnitSpecs.ControllerSpecs.AnswerControllerUnitSpec.$anonfun$new$2(AnswerControllerUnitSpec.scala:67)
at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
at org.scalatest.Transformer.apply(Transformer.scala:22)
at org.scalatest.Transformer.apply(Transformer.scala:20)
at org.scalatest.WordSpecLike$$anon$1.apply(WordSpecLike.scala:1078)
at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)
at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)
at org.scalatest.WordSpec.withFixture(WordSpec.scala:1881)
at org.scalatest.WordSpecLike.invokeWithFixture$1(WordSpecLike.scala:1076)
at org.scalatest.WordSpecLike.$anonfun$runTest$1(WordSpecLike.scala:1088)
at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
at org.scalatest.WordSpecLike.runTest(WordSpecLike.scala:1088)
at org.scalatest.WordSpecLike.runTest$(WordSpecLike.scala:1070)
at UnitSpecs.ControllerSpecs.AnswerControllerUnitSpec.org$scalatest$BeforeAndAfterEach$$super$runTest(AnswerControllerUnitSpec.scala:32)
at org.scalatest.BeforeAndAfterEach.runTest(BeforeAndAfterEach.scala:221)
at org.scalatest.BeforeAndAfterEach.runTest$(BeforeAndAfterEach.scala:214)
at UnitSpecs.ControllerSpecs.AnswerControllerUnitSpec.runTest(AnswerControllerUnitSpec.scala:32)
at org.scalatest.WordSpecLike.$anonfun$runTests$1(WordSpecLike.scala:1147)
at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:396)
at scala.collection.immutable.List.foreach(List.scala:389)
at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:373)
at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:410)
at scala.collection.immutable.List.foreach(List.scala:389)
at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:379)
at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461)
at org.scalatest.WordSpecLike.runTests(WordSpecLike.scala:1147)
at org.scalatest.WordSpecLike.runTests$(WordSpecLike.scala:1146)
at org.scalatest.WordSpec.runTests(WordSpec.scala:1881)
at org.scalatest.Suite.run(Suite.scala:1147)
at org.scalatest.Suite.run$(Suite.scala:1129)
at org.scalatest.WordSpec.org$scalatest$WordSpecLike$$super$run(WordSpec.scala:1881)
at org.scalatest.WordSpecLike.$anonfun$run$1(WordSpecLike.scala:1192)
at org.scalatest.SuperEngine.runImpl(Engine.scala:521)
at org.scalatest.WordSpecLike.run(WordSpecLike.scala:1192)
at org.scalatest.WordSpecLike.run$(WordSpecLike.scala:1190)
at UnitSpecs.ControllerSpecs.AnswerControllerUnitSpec.org$scalatest$BeforeAndAfterAll$$super$run(AnswerControllerUnitSpec.scala:32)
at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:213)
at org.scalatest.BeforeAndAfterAll.run(BeforeAndAfterAll.scala:210)
at org.scalatest.BeforeAndAfterAll.run$(BeforeAndAfterAll.scala:208)
at UnitSpecs.ControllerSpecs.AnswerControllerUnitSpec.org$scalatestplus$play$BaseOneAppPerSuite$$super$run(AnswerControllerUnitSpec.scala:32)
at org.scalatestplus.play.BaseOneAppPerSuite.run(BaseOneAppPerSuite.scala:46)
at org.scalatestplus.play.BaseOneAppPerSuite.run$(BaseOneAppPerSuite.scala:41)
at UnitSpecs.ControllerSpecs.AnswerControllerUnitSpec.run(AnswerControllerUnitSpec.scala:32)
at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1340)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1334)
at scala.collection.immutable.List.foreach(List.scala:389)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1500)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
at org.scalatest.tools.Runner$.run(Runner.scala:850)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:133)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:27)
Process finished with exit code 0
The error seem to be for line val logger = LoggerFactory.getLogger(this.getClass.getName) which to be honest doesn't make sense.
Below is the sample program, that is generating a gwak command and executing it from scala.
Generated command is giving "invalid character in expression error"
If the same command is executed directly from macOS commandline, it works without error.
package org.mogli.pup.main
object GAwkSample {
def main(args: Array[String]): Unit = {
val text = "hello world"
val home = sys.env("HOME")
val cmnd = s"gawk -i inplace 'NR==7{print " + "\"" + text + "\"" + s"}1' ${home}/FirstEg.txt"
println(s"$cmnd")
import sys.process._
s"$cmnd" !
}
}
Output of above scala program :-
gawk -i inplace 'NR==7{print "hello world"}1' /Users/mogli/FirstEg.txt
gawk: cmd.
line:1: 'NR==7{print gawk: cmd. line:1: ^ invalid char ''' in
expression
When running a external command, exceptions are simply displayed to the std output. How can I manage them from inside the code ?
Example :
import sys.process._
("yes -y 100" #| "head -c 1").!
I simply get the following stacktrace.
java.io.IOException: Pipe closed
at java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:261)
at java.io.PipedInputStream.awaitSpace(PipedInputStream.java:269)
at java.io.PipedInputStream.receive(PipedInputStream.java:232)
at java.io.PipedOutputStream.write(PipedOutputStream.java:149)
at scala.sys.process.BasicIO$.loop$1(BasicIO.scala:236)
at scala.sys.process.BasicIO$.transferFullyImpl(BasicIO.scala:242)
at scala.sys.process.BasicIO$.transferFully(BasicIO.scala:223)
at scala.sys.process.ProcessImpl$PipeThread.runloop(ProcessImpl.scala:159)
at scala.sys.process.ProcessImpl$PipeSource.run(ProcessImpl.scala:179)
Any try catch seems to be ignored.
Printing to stdout is what .! does. You will need to use .! with custom process logger, i.e.:
import scala.sys.process._
("yes -y 100" #| "head -c 1").!(new ProcessLogger {
override def buffer[T](f: => T): T = f
override def out(s: => String): Unit = ()
override def err(s: => String): Unit = ()
})
.... or just .!! to get a string