gpt4 book ai didi

java - NetLogo HPC 内存错误

转载 作者:行者123 更新时间:2023-11-30 03:19:43 25 4
gpt4 key购买 nike

#!/bin/bash
#$ -N para_three
#$ -q all.q
#$ -pe mpi 30
/home/abhishekb/netlogo/netlogo-5.2.0/netlogo-headless.sh \
--model /home/abhishekb/models/try4.nlogo \
--experiment experiment1 \
--table /home/abhishekb/csvresults/24.04_Results.csv

错误:

Exception in thread "JobThread" 
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JobThread"
Exception in thread "JobThread"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JobThread"
Exception in thread "JobThread"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JobThread"

为什么,我不明白?我找到了关于使用 64 位 java 运行 NetLogo 的建议。但链接[1] [2]已过期,请帮忙。

令人惊讶的是,早些时候我在 NetLogo 5.1 上运行它并且从未遇到此错误。

脚本更改:我尝试在末尾添加线程:

#!/bin/bash
#$ -N para_three
#$ -q all.q
#$ -pe mpi 30
/home/abhishekb/netlogo/netlogo-5.2.0/netlogo-headless.sh \
--model /home/abhishekb/models/try4.nlogo \
--experiment experiment1 \
--table /home/abhishekb/csvresults/24.04_Results.csv \
--threads 30

新错误:

Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at org.nlogo.generator.CustomClassLoader.loadClass(CustomClassLoader.scala:27)
at org.nlogo.generator.CustomClassLoader.loadBytecodeClass(CustomClassLoader.scala:32)
at org.nlogo.generator.Generator$InstructionGenerator.finish(Generator.scala:241)

编辑3:

#!/bin/sh
cd "`dirname "$0"`" # the copious quoting is for handling paths with spaces
#-Xmx3000m use up to 1GB RAM (edit to increase)
# -Dfile.encoding=UTF-8 ensure Unicode characters in model files are compatible cross-platform
# -classpath NetLogo.jar specify main jar
# org.nlogo.headless.Main specify we want headless, not GUI
# "$@" pass along any command line arguments
-XX:MaxPermSize=3200m avoid OutOfMemory errors for large models
java -Xmx1024m -Dfile.encoding=UTF-8 -classpath NetLogo.jar org.nlogo.headless.Main "$@"

错误:

/home/abhishekb/netlogo/netlogo-5.2.0/netlogo-headless.sh: line 8: -XX:MaxPermSize=3200m: command not found Exception in thread "main" java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at org.nlogo.generator.CustomClassLoader.loadClass(CustomClassLoader.scala:27) at org.nlogo.generator.CustomClassLoader.loadBytecodeClass(CustomClassLoader.scala:32) at org.nlogo.generator.Generator$InstructionGenerator.finish(Generator.scala:241) at org.nlogo.generator.Generator$InstructionGenerator.generate(Generator.scala:93) at org.nlogo.generator.Generator.org$nlogo$generator$Generator$$recurse(Generator.scala:28) at org.nlogo.generator.Generator$InstructionGenerator$$anonfun$generateOldStyleCall$1.apply(Generator.scala:208) at org.nlogo.generator.Generator$InstructionGenerator$$anonfun$generateOldStyleCall$1.apply(Generator.scala:208) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233) at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34) at scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:38) at scala.collection.TraversableLike$class.map(TraversableLike.scala:233) at scala.collection.mutable.ArrayOps.map(ArrayOps.scala:38) at org.nlogo.generator.Generator$InstructionGenerator.generateOldStyleCall(Generator.scala:208) at org.nlogo.generator.Generator$InstructionGenerator.generateInstruction(Generator.scala:146) at org.nlogo.generator.Generator$InstructionGenerator$$anonfun$generateInstruction$1.apply$mcVI$sp(Generator.scala:167) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:78) at org.nlogo.generator.Generator$InstructionGenerator.generateInstruction(Generator.scala:159) at org.nlogo.generator.Generator$InstructionGenerator$$anonfun$generateInstruction$1.apply$mcVI$sp(Generator.scala:167) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:78) at org.nlogo.generator.Generator$InstructionGenerator.generateInstruction(Generator.scala:159) at org.nlogo.generator.Generator$InstructionGenerator$$anonfun$generateInstruction$1.apply$mcVI$sp(Generator.scala:167) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:81) at org.nlogo.generator.Generator$InstructionGenerator.generateInstruction(Generator.scala:159) at org.nlogo.generator.Generator$InstructionGenerator$$anonfun$generateInstruction$1.apply$mcVI$sp(Generator.scala:167) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:78) at org.nlogo.generator.Generator$InstructionGenerator.generateInstruction(Generator.scala:159) at org.nlogo.generator.Generator$InstructionGenerator.generateBodyMethod(Generator.scala:115) at org.nlogo.generator.Generator$InstructionGenerator.generate(Generator.scala:90) at org.nlogo.generator.Generator.org$nlogo$generator$Generator$$recurse(Generator.scala:28)

最佳答案

错误消息涉及 PermGen,因此这意味着问题不是堆的总大小,而是具体的 PermGen 上限。您需要使用更高的 PermGen 设置来启动 Java,例如-XX:MaxPermSize=512m。您的 netlogo-headless.sh 文件中可能已经有这样的设置;如果是这样,请增加它。如果还没有这样的设置,请添加一个。

我大约 98% 确信这与 NetLogo 5.1 和 5.2 之间的任何差异无关。您现在使用 5.2 所做的事情和当时使用 5.1 所做的事情可能还有其他不同之处(可能是 threads= 设置的大小)。

以下是 NetLogo 5.2 的默认 netlogo.shnetlogo-headless.sh 文件的工作链接:https://github.com/NetLogo/NetLogo/blob/5.2.0/dist/netlogo.sh , https://github.com/NetLogo/NetLogo/blob/5.2.0/dist/netlogo-headless.sh

运行 64 位 JVM 与解决 PermGen 问题并不特别相关,但对于运行非常大的堆可能是必要的。

关于java - NetLogo HPC 内存错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31644503/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com