Spark streaming on Mesos - random failures of Marathon tasks - spark-streaming

I'm using Mesos 1.1.0 cluster for both Spark batch and Spark streaming jobs. Batch is working without any problem with same Spark URI-s, Streaming is behaving abnormally from time to time.
Streaming job is started using Marathon 1.3.6 by running simple bash submit script. Script is local on all slaves, same on all slaves.
Script:
spark-submit --class "$1" --master mesos://zk://master1:2181,master2:2181,master3:2181/mesos --conf spark.executor.uri=/spark/spark-2.0.1-bin-hadoop2.6.tgz --conf spark.cores.max=2 --conf spark.eventLog.enabled=false /spark_jobs/"$2"
This all works well most of the time, Marathon deploys the job, job starts and remains active and working.
Here is sample of Mesos stderr for job which starts fine. It is just the beginning of the log file because I beleive it is where the issue appears.
#################### START OF Normal stderr
I1224 09:02:00.480056 23118 fetcher.cpp:498] Fetcher Info: {"cache_directory":"\/tmp\/mesos\/fetch\/slaves\/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3\/root","items":[{"action":"BYPASS_CACHE","uri":{"extract":true,"value":"\/spark\/spark-2.0.1-bin-hadoop2.6.tgz"}}],"sandbox_directory":"\/var\/lib\/mesos\/slaves\/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3\/frameworks\/cd6497c0-d374-4957-b861-286fd0b27587-13920\/executors\/0\/runs\/feb948b2-1b37-4962-a682-77aeb45a3063","user":"root"}
I1224 09:02:00.483033 23118 fetcher.cpp:409] Fetching URI '/spark/spark-2.0.1-bin-hadoop2.6.tgz'
I1224 09:02:00.483050 23118 fetcher.cpp:250] Fetching directly into the sandbox directory
I1224 09:02:00.483072 23118 fetcher.cpp:187] Fetching URI '/spark/spark-2.0.1-bin-hadoop2.6.tgz'
I1224 09:02:00.483088 23118 fetcher.cpp:167] Copying resource with command:cp '/spark/spark-2.0.1-bin-hadoop2.6.tgz' '/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/cd6497c0-d374-4957-b861-286fd0b27587-13920/executors/0/runs/feb948b2-1b37-4962-a682-77aeb45a3063/spark-2.0.1-bin-hadoop2.6.tgz'
I1224 09:02:00.675047 23118 fetcher.cpp:84] Extracting with command: tar -C '/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/cd6497c0-d374-4957-b861-286fd0b27587-13920/executors/0/runs/feb948b2-1b37-4962-a682-77aeb45a3063' -xf '/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/cd6497c0-d374-4957-b861-286fd0b27587-13920/executors/0/runs/feb948b2-1b37-4962-a682-77aeb45a3063/spark-2.0.1-bin-hadoop2.6.tgz'
I1224 09:02:02.797693 23118 fetcher.cpp:92] Extracted '/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/cd6497c0-d374-4957-b861-286fd0b27587-13920/executors/0/runs/feb948b2-1b37-4962-a682-77aeb45a3063/spark-2.0.1-bin-hadoop2.6.tgz' into '/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/cd6497c0-d374-4957-b861-286fd0b27587-13920/executors/0/runs/feb948b2-1b37-4962-a682-77aeb45a3063'
I1224 09:02:02.797751 23118 fetcher.cpp:547] Fetched '/spark/spark-2.0.1-bin-hadoop2.6.tgz' to '/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/cd6497c0-d374-4957-b861-286fd0b27587-13920/executors/0/runs/feb948b2-1b37-4962-a682-77aeb45a3063/spark-2.0.1-bin-hadoop2.6.tgz'
I1224 09:02:02.850260 23144 exec.cpp:162] Version: 1.1.0
I1224 09:02:02.852879 23147 exec.cpp:237] Executor registered on agent bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
16/12/24 09:02:03 INFO CoarseGrainedExecutorBackend: Started daemon with process name: 23155#mr02
16/12/24 09:02:03 INFO SignalUtils: Registered signal handler for TERM
16/12/24 09:02:03 INFO SignalUtils: Registered signal handler for HUP
16/12/24 09:02:03 INFO SignalUtils: Registered signal handler for INT
16/12/24 09:02:04 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/12/24 09:02:04 INFO SecurityManager: Changing view acls to: root
16/12/24 09:02:04 INFO SecurityManager: Changing modify acls to: root
16/12/24 09:02:04 INFO SecurityManager: Changing view acls groups to:
16/12/24 09:02:04 INFO SecurityManager: Changing modify acls groups to:
16/12/24 09:02:04 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); groups with view permissions: Set(); users with modify permissions: Set(root); groups with modify permissions: Set()
16/12/24 09:02:04 INFO TransportClientFactory: Successfully created connection to /10.210.197.151:57731 after 82 ms (0 ms spent in bootstraps)
Sometimes when we restart this job, job gets initialized, it registers as framework in Mesos, it starts Spark web UI, but it does nothing, all tasks are queued and it is doing some weird stuff (calculating stages of WHAT?). Sometimes it takes several restarts to make it work like it should, which is not desired behaviour, since process should be automated.
#### START OF Abnormal stderr
I1224 08:32:11.346411 19741 exec.cpp:162] Version: 1.1.0
I1224 08:32:11.348379 19743 exec.cpp:237] Executor registered on agent bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#726: Client environment:zookeeper.version=zookeeper C client 3.4.8
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#730: Client environment:host.name=mr02
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#737: Client environment:os.name=Linux
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#738: Client environment:os.arch=3.13.0-100-generic
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#739: Client environment:os.version=#147-Ubuntu SMP Tue Oct 18 16:48:51 UTC 2016
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#747: Client environment:user.name=(null)
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#755: Client environment:user.home=/root
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#log_env#767: Client environment:user.dir=/var/lib/mesos/slaves/bf8a3062-0309-4c1f-91cd-79d7515f9ce7-S3/frameworks/aee5cbd3-b3e8-431d-bc18-fb5107d54074-0000/executors/jobs_storagetraffic17.76d13635-c9b3-11e6-bf95-bc764e104d04/runs/cd1a62ea-4cda-4599-a6fc-e7c5d1ad3956
2016-12-24 08:32:13,838:19753(0x7f8864b02700):ZOO_INFO#zookeeper_init#800: Initiating client connection, host=mr01:2181,mr02:2181,mr03:2181 sessionTimeout=10000 watcher=0x7f8872f72200 sessionId=0 sessionPasswd=<null> context=0x7f883c000b10 flags=0
I1224 08:32:13.839673 19843 sched.cpp:226] Version: 1.1.0
2016-12-24 08:32:13,840:19753(0x7f88577fe700):ZOO_INFO#check_events#1728: initiated connection to server [10.210.224.189:2181]
2016-12-24 08:32:13,845:19753(0x7f88577fe700):ZOO_INFO#check_events#1775: session establishment complete on server [10.210.224.189:2181], sessionId=0x3592d18d17a001a, negotiated timeout=10000
I1224 08:32:13.845521 19838 group.cpp:340] Group process (zookeeper-group(1)#10.210.198.20:43514) connected to ZooKeeper
I1224 08:32:13.845562 19838 group.cpp:828] Syncing group operations: queue size (joins, cancels, datas) = (0, 0, 0)
I1224 08:32:13.845579 19838 group.cpp:418] Trying to create path '/mesos' in ZooKeeper
I1224 08:32:13.846849 19838 detector.cpp:152] Detected a new leader: (id='27')
I1224 08:32:13.846951 19838 group.cpp:697] Trying to get '/mesos/json.info_0000000027' in ZooKeeper
I1224 08:32:13.847759 19841 zookeeper.cpp:259] A new leading master (UPID=master#10.210.224.189:5050) is detected
I1224 08:32:13.847839 19838 sched.cpp:330] New master detected at master#10.210.224.189:5050
I1224 08:32:13.848011 19838 sched.cpp:341] No credentials provided. Attempting to register without authentication
I1224 08:32:13.850549 19841 sched.cpp:743] Framework registered with cd6497c0-d374-4957-b861-286fd0b27587-13914
16/12/24 08:32:14 INFO utils.VerifiableProperties: Verifying properties
16/12/24 08:32:14 INFO utils.VerifiableProperties: Property group.id is overridden to
16/12/24 08:32:14 INFO utils.VerifiableProperties: Property zookeeper.connect is overridden to
16/12/24 08:32:20 INFO utils.VerifiableProperties: Verifying properties
16/12/24 08:32:20 INFO utils.VerifiableProperties: Property group.id is overridden to
16/12/24 08:32:20 INFO utils.VerifiableProperties: Property zookeeper.connect is overridden to
[Stage 0:> (0 + 0) / 31]
[Stage 0:> (0 + 1) / 31]
[Stage 0:> (0 + 2) / 31]
[Stage 0:=> (1 + 3) / 31]
[Stage 0:==================================> (19 + 0) / 31]
[Stage 1:==================================> (19 + 0) / 31]
[Stage 2:==================================> (19 + 0) / 31]
[Stage 3:==================================> (19 + 0) / 31]
[Stage 4:==================================> (19 + 0) / 31]
[Stage 5:==================================> (19 + 0) / 31]
[Stage 6:==================================> (19 + 0) / 31]
[Stage 7:==================================> (19 + 0) / 31]
[Stage 8:==================================> (19 + 0) / 31]
[Stage 9:==================================> (19 + 0) / 31]
[Stage 10:==================================> (19 + 0) / 31]
[Stage 11:==================================> (19 + 0) / 31]
[Stage 12:==================================> (19 + 0) / 31]
[Stage 13:==================================> (19 + 0) / 31]
[Stage 13:==================================> (19 + 2) / 31]
[Stage 14:==================================> (19 + 0) / 31]
[Stage 14:=====================================> (21 + 2) / 31]
[Stage 15:==================================> (19 + 0) / 31]
[Stage 15:=====================================> (21 + 2) / 31]
[Stage 16:==================================> (19 + 0) / 31]
[Stage 16:=========================================> (23 + 2) / 31]
[Stage 17:==================================> (19 + 0) / 31]
[Stage 17:=============================================> (25 + 2) / 31]
[Stage 18:==================================> (19 + 0) / 31]
[Stage 18:=============================================> (25 + 2) / 31]
[Stage 19:==================================> (19 + 0) / 31]
[Stage 19:=============================================> (25 + 2) / 31]
[Stage 20:==================================> (19 + 0) / 31]
[Stage 20:===========================================> (24 + 2) / 31]
[Stage 21:==================================> (19 + 0) / 31]
[Stage 22:==================================> (19 + 0) / 31]
[Stage 23:==================================> (19 + 0) / 31]
[Stage 24:==================================> (19 + 0) / 31]
[Stage 25:==================================> (19 + 0) / 31]
[Stage 26:==================================> (19 + 0) / 31]
[Stage 27:==================================> (19 + 0) / 31]
[Stage 28:==================================> (19 + 0) / 31]
[Stage 29:==================================> (19 + 0) / 31]
[Stage 30:==================================> (19 + 0) / 31]
[Stage 31:==================================> (19 + 0) / 31]
[Stage 32:==================================> (19 + 0) / 31]
[Stage 33:==================================> (19 + 0) / 31]
[Stage 34:==================================> (19 + 0) / 31]
[Stage 35:==================================> (19 + 0) / 31]
[Stage 36:==================================> (19 + 0) / 31]
[Stage 37:==================================> (19 + 0) / 31]
[Stage 38:==================================> (19 + 0) / 31]
[Stage 39:==================================> (19 + 0) / 31]
I suspect thet problem is in first few lines of the log file, for some reason abnormal job does not have fetcher part, maybe it is not copying /spark/spark-2.0.1-bin-hadoop2.6.tgz and does not have binaries to start...but then, how does it starts Spark UI?
Does anyone has any ideas how to solve this problem, where to look for additional clues, what to test to get more data?
Thanks,
Ivan

Related

Algorithm to generate incremental numbers up to a fixed number using a set of given numbers

We have a requirement where we want to generate incremental numbers until a target number using a given set of numbers.
(The given set of numbers may vary, and the algorithm needs to work for any set of numbers. Though, practically we are expecting the set to contain up to 15 numbers.)
Assumptions: All the numbers in the given set are assumed to be integers.
By incremental numbers I mean all the numbers possible by adding multiples of a given set of numbers.
E.g. Let's say the we have a set {12, 13, 17} and the target number is 50. Then the incremental numbers are {0, 12, 13, 17, 24, 25, 26, 29, 30, 34, 36, 37, 38, 39, 41, 42, 43, 46, 47, 48, 49, 50}
(Explanation for the above incremental numbers:
0 = (12 * 0) + (13 * 0) + (17 * 0)
12 = (12 * 1) + (13 * 0) + (17 * 0)
13 = (12 * 0) + (13 * 1) + (17 * 0)
17 = (12 * 0) + (13 * 0) + (17 * 1)
24 = (12 * 2) + (13 * 0) + (17 * 0)
25 = (12 * 1) + (13 * 1) + (17 * 0)
26 = (12 * 0) + (13 * 2) + (17 * 0)
29 = (12 * 1) + (13 * 0) + (17 * 1)
30 = (12 * 0) + (13 * 1) + (17 * 1)
34 = (12 * 0) + (13 * 0) + (17 * 2)
36 = (12 * 3) + (13 * 0) + (17 * 0)
37 = (12 * 2) + (13 * 1) + (17 * 0)
38 = (12 * 1) + (13 * 2) + (17 * 0)
39 = (12 * 0) + (13 * 3) + (17 * 0)
41 = (12 * 2) + (13 * 0) + (17 * 1)
42 = (12 * 1) + (13 * 1) + (17 * 1)
43 = (12 * 0) + (13 * 2) + (17 * 1)
46 = (12 * 1) + (13 * 0) + (17 * 2)
47 = (12 * 0) + (13 * 1) + (17 * 2)
48 = (12 * 4) + (13 * 0) + (17 * 0)
49 = (12 * 3) + (13 * 1) + (17 * 0)
50 = (12 * 2) + (13 * 2) + (17 * 0)
)
Could anybody help me with an optimized solution for this ?
It's hard to do much better than a brute-force approach here. You can discard any number that is divisible by another number in the list. Then, you can use the following algorithm:
lst = [12,13,17]
target = 50
sums = {0}
for i in lst:
new_sums = set()
for j in sums:
x = j + i
while x <= target and x not in new_sums:
new_sums.add(x)
x += i
sums = sums.union(new_sums)
print(sums)
# {0, 12, 13, 17, 24, 25, 26, 29, 30, 34, 36, 37, 38, 39, 41, 42, 43, 46, 47, 48, 49, 50}

Xcode 10.1 craches on startup within virtual container

I'm a new one in the Mac world and currently I'm trying to run Xcode 10.1 within the vmware container with Mac OS X 10.14.
I was able to successfully install Xcode from the AppStore...but can't start Xcode itself. It crashed after initial window (aka, Create a new project...) with full stack trace:
Process: Xcode [626]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 10.1 (14460.46)
Build Info: IDEFrameworks_Fall2018-14460046000000000~5
App Item ID: 497799835
App External ID: 828917606
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [626]
User ID: 501
Date/Time: 2018-11-02 13:55:14.216 +0100
OS Version: Mac OS X 10.14 (18A293u)
Report Version: 12
Anonymous UUID: D2FB79AD-8219-9107-CB64-93B01CB6F4C5
Sleep/Wake UUID: C189A821-D94E-4E2B-98A8-2B12B39649D7
Time Awake Since Boot: 1500 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
Sending newProject: to <IDEApplicationCommands: 0x7fe071a42100> from (null)
ProductBuildVersion: 10B61
UNCAUGHT EXCEPTION (NSInvalidArgumentException): +[NSColor detailAccentColor]: unrecognized selector sent to class 0x7fff9cc3c0a8
UserInfo: (null)
Hints:
0: Sending newProject: to <IDEApplicationCommands: 0x7fe071a42100> from (null)
1: Sending openNewProjectAssistant: to <IDEWelcomeWindowController: 0x7fe0712418e0> from <IDEWelcomeWindowHighlightButton: 0x7fe0727649f0>
Backtrace:
0 __exceptionPreprocess (in CoreFoundation)
1 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
2 objc_exception_throw (in libobjc.A.dylib)
3 __CFExceptionProem (in CoreFoundation)
4 ___forwarding___ (in CoreFoundation)
5 _CF_forwarding_prep_0 (in CoreFoundation)
64 NSApplicationMain (in AppKit)
65 main (in Xcode)
66 start (in libdyld.dylib)
abort() called
Application Specific Signatures:
NSInvalidArgumentException
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff420984ee __exceptionPreprocess + 197
1 DVTFoundation 0x000000010eed98c2 DVTFailureHintExceptionPreprocessor + 274
2 libobjc.A.dylib 0x00007fff6e07576b objc_exception_throw + 48
64 AppKit 0x00007fff3f589c26 NSApplicationMain + 780
65 Xcode 0x000000010ec4682e main + 574
66 libdyld.dylib 0x00007fff6efebee1 start + 1
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff6f15beb6 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6f1f9088 pthread_kill + 285
2 libsystem_c.dylib 0x00007fff6f0a8189 abort + 127
3 com.apple.dt.IDEKit 0x0000000110b25793 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 1324
Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133
Binary Images:
com.apple.dt.Xcode (10.1 - 14460.46)
com.apple.dt.DVTFoundation (10.1 - 14460.28)
com.apple.dt.DVTKit (10.1 - 14460.28)
com.apple.dt.IDEFoundation (10.1 - 14460.46)
com.apple.dt.IDEKit (10.1 - 14460.46)
+libswiftAVFoundation.dylib (4.2.1 - 1000.11.42)
+libswiftCore.dylib (4.2.1 - 1000.11.42)
+libswiftCoreAudio.dylib (4.2.1 - 1000.11.42)
+libswiftCoreFoundation.dylib (4.2.1 - 1000.11.42)
+libswiftCoreGraphics.dylib (4.2.1 - 1000.11.42)
+libswiftCoreImage.dylib (4.2.1 - 1000.11.42)
+libswiftCoreMedia.dylib (4.2.1 - 1000.11.42)
+libswiftDarwin.dylib (4.2.1 - 1000.11.42)
+libswiftDispatch.dylib (4.2.1 - 1000.11.42)
+libswiftFoundation.dylib (4.2.1 - 1000.11.42)
+libswiftIOKit.dylib (4.2.1 - 1000.11.42)
+libswiftMetal.dylib (4.2.1 - 1000.11.42)
+libswiftObjectiveC.dylib (4.2.1 - 1000.11.42)
+libswiftQuartzCore.dylib (4.2.1 - 1000.11.42)
+libswiftXPC.dylib (4.2.1 - 1000.11.42)
+libswiftsimd.dylib (4.2.1 - 1000.11.42)
com.apple.dt.DVTJRPC (1.0 - 1)
com.apple.dt.DVTDeviceControlServices (1.0 - 1)
com.apple.DebugSymbols (188 - 188)
com.apple.XCWatchKit1Support (1.0 - 1)
com.apple.CoreSymbolicationDT (10.1 - 64460.7)
com.apple.assetvalidation-plugin (1.0 - 1)
com.apple.dt.instruments.DTXConnectionServices (10.1 - 64460.16)
+cvmsCodeSignObjqEZSGwI1dDAVVakc (???)
com.apple.dt.instruments.DVTInstrumentsFoundation (10.1 - 64460.16)
com.apple.Metal (1.0 - 1)
+libswiftAppKit.dylib (4.2.1 - 1000.11.42)
com.apple.IBCompilerPlugin (10.1 - 14460.31)
+libswiftCoreData.dylib (4.2.1 - 1000.11.42)
com.apple.SymbolicationDT (10.1 - 64460.9)
com.apple.kperfdataDT (1.0 - 1)
com.apple.libktrace (1.0 - 271.200.30)
com.apple.dt.instruments.DVTInstrumentsUtilities (10.1 - 64460.16)
+libswiftos.dylib (4.2.1 - 1000.11.42)
com.apple.xcode.compilers.coredata (12.1 - 14460.26)
com.apple.dt.DVTServices (10.1 - 14460.28)
com.apple.compilers.clang (12.1 - 14460.26)
com.apple.dt.DVTPortal (10.1 - 1)
com.apple.dt.XCTest (1.0 - 14460.20)
com.apple.dt.DVTDeviceFoundation (10.1 - 1)
com.apple.dt.XCTAutomationSupport (1.0 - 1)
+libclang.dylib (1000.11.45.5)
com.apple.dt.SourceKit (1.0 - 14460.2)
+libLTO.dylib (1000.11.45.5)
com.apple.dt.DVTAnalytics (1.0 - 1)
com.apple.dt.DVTDocumentation (1.0 - 14460.28)
com.apple.DNTDocumentationModel (1.0 - 14460.6)
com.apple.DNTDocumentationSupport (1.0 - 14460.6)
com.apple.dt.XCTDaemonControl (1.0 - 1)
com.apple.LocFramework (2.0 - 42)
com.apple.GLToolsMobileFoundation (1.0 - 24215)
com.apple.dt.Xcode.DVTSourceControl (10.1 - 14460.4)
com.apple.dt.XcodeKit (10.1 - 14460.46)
+cvmsCodeSignObj9eLJFERShVqDWRe6 (???)
com.apple.DNTSourceKitSupport (1.0 - 14460.6)
+libswiftXCTest.dylib (4.2.1 - 1000.11.42)
com.apple.dt.DVTAnalyticsClient (10.1 - 1)
com.apple.DNTTransformer (1.0 - 14460.6)
com.apple.dt.IDEProducts (1.0 - 1)
com.apple.dt.DVTDeveloperModeHelper (1.0 - 1)
com.apple.dt.instruments.DTGraphKit (10.1 - 64460.12)
com.apple.dt.DebugHierarchyFoundation (1.0 - 2)
com.apple.CoreSimulator.CoreSimulatorUtilities (581.2 - 581.2)
com.apple.CoreSimulator.CoreSimDeviceIO (581.2 - 581.2)
+libMainThreadChecker.dylib (64460.8)
com.apple.dt.dbg.DebuggerFoundation (10.1 - 14460.32)
com.apple.IDEWatchKit1SupportUI (10.1 - 14460.2)
com.apple.dt.dbg.DebuggerLLDBService (10.1 - 14460.32)
com.apple.DevToolsFoundation (12.1 - 14460.26)
+liblaunch_sim.dylib (1336.220.5)
com.apple.CoreSimulator (581.2 - 581.2)
com.apple.dt.DebugHierarchyKit (1.0 - 2)
com.apple.LLDBRPC (1.0 - 1000.11.38.2)
com.apple.dt.XCTDaemonControlMobileDevice (1.0 - 1)
com.apple.DVTiPhoneSimulatorRemoteClient (10.1 - 14460.19)
com.apple.XCWatchOSSupport (1.0 - 1)
com.apple.xcode.compilers.mlkit (12.1 - 14460.3)
com.apple.dt.IBAutolayoutFoundation (10.1 - 14460.31)
com.apple.dt.IBFoundation (10.1 - 14460.31)
com.apple.AppleCV3D (1.21.3 - 1.21.3)
com.apple.dt.dbg.DebuggerLLDB (10.1 - 14460.32)
com.apple.dt.IDE.Xcode3Core (10.1 - 14460.26)
com.apple.Xcode.DevToolsCore (12.1 - 14460.26)
com.apple.Xcode.DevToolsSupport (12.1 - 14460.26)
com.apple.dt.IDE.IDEiOSSupportCore (10.1 - 14460.19)
com.apple.DTDeviceKitBase (10.1 - 14460.19)
com.apple.dt.XCLanguageSupport (10.1 - 14460.4)
com.apple.xcode.compilers.intents (10.1 - 14460.4)
com.apple.xcode.plug-in.CoreBuildTasks (12.1 - 14460.26)
...
com.apple.HIServices (1.22 - 627.10)
com.apple.LangAnalysis (1.7.0 - 1.7.0)
com.apple.print.framework.PrintCore (14.0 - 503.3)
com.apple.QD (3.12 - 407)
com.apple.speech.synthesis.framework (8.0.6 - 8.0.6)
com.apple.audio.toolbox.AudioToolbox (1.14 - 1.14)
com.apple.audio.units.AudioUnit (1.14 - 1.14)
com.apple.AutomatorFramework (2.9 - 444.23.1)
com.apple.CFNetwork (948.2 - 948.2)
com.apple.Carbon (158 - 158)
com.apple.CommonPanels (1.2.6 - 98)
com.apple.HIToolbox (2.1.1 - 916.15)
com.apple.help (1.3.8 - 66)
com.apple.ImageCapture (9.0 - 1511.3)
com.apple.ink.framework (10.9 - 222)
com.apple.openscripting (1.7 - 176)
com.apple.print.framework.Print (12 - 267)
com.apple.securityhi (9.0 - 55006)
com.apple.speech.recognition.framework (6.0.3 - 6.0.3)
com.apple.Cocoa (6.11 - 23)
com.apple.ColorSync (4.13.0 - 3331)
com.apple.contacts (1.0 - 2876)
com.apple.audio.CoreAudio (4.3.0 - 4.3.0)
com.apple.CoreBluetooth (1.0 - 1)
com.apple.CoreData (120 - 862.7)
com.apple.CoreDisplay (101.8 - 101.8)
com.apple.CoreFoundation (6.9 - 1535.12)
com.apple.CoreGraphics (2.0 - 1215.5)
com.apple.CoreImage (14.0.0 - 643)
com.apple.corelocation (2245.4.48.9)
com.apple.CoreML (1.0 - 1)
com.apple.CoreMedia (1.0 - 2280.60.8.2)
com.apple.CoreMediaIO (900.0 - 5019)
com.apple.CoreServices (921.2 - 921.2)
com.apple.AE (755.5 - 755.5)
com.apple.CoreServices.CarbonCore (1178.7 - 1178.7)
com.apple.DictionaryServices (1.2 - 284.15.2)
com.apple.CoreServices.FSEvents (1239.200.9.10.1 - 1239.200.9.10.1)
com.apple.LaunchServices (920 - 920)
com.apple.Metadata (10.7.0 - 1191.23.3)
com.apple.CoreServices.OSServices (920 - 920)
com.apple.SearchKit (1.4.0 - 1.4.0)
com.apple.coreservices.SharedFileList (71.9 - 71.22)
com.apple.CoreText (352.0 - 584.9.1.2)
com.apple.CoreVideo (1.8 - 0.0)
com.apple.framework.CoreWLAN (13.0 - 1370.5)
com.apple.DirectoryService.Framework (10.14 - 207.50.1)
com.apple.DiscRecording (9.0.3 - 9030.4.5)
com.apple.DiscRecordingUI (9.0.3 - 9030.4.5)
com.apple.DiskArbitration (2.7 - 2.7)
com.apple.Foundation (6.9 - 1535.12)
com.apple.GLKit (1.0 - 101)
com.apple.GSS (4.0 - 2.0)
com.apple.Bluetooth (6.0.8 - 6.0.8d20)
com.apple.framework.IOKit (2.0.2 - 1483.200.35)
com.apple.IOSurface (245 - 245)
com.apple.ImageCaptureCore (1.0 - 1511.3)
com.apple.ImageIO.framework (3.3.0 - 1771.2)
libGIF.dylib (1771.2)
libJP2.dylib (1771.2)
libJPEG.dylib (1771.2)
libPng.dylib (1771.2)
libRadiance.dylib (1771.2)
dylib (1771.2)
com.apple.JavaScriptCore (14606 - 14606.1.17.40.4)
com.apple.Kerberos (3.0 - 1)
com.apple.LDAPFramework (2.4.28 - 194.5)
com.apple.MapKit (1.0 - 1833.20.5.10.7)
com.apple.MediaAccessibility (1.0 - 114.3)
com.apple.MediaPlayer (1.0 - 1.0)
com.apple.MediaToolbox (1.0 - 2280.60.8.2)
com.apple.Metal (157.25 - 157.25)
com.apple.MetalKit (1.0 - 107.4.1)
com.apple.MetalPerformanceShaders.MPSCore (1.0 - 1)
com.apple.MetalPerformanceShaders.MPSImage (1.0 - 1)
com.apple.MetalPerformanceShaders.MPSMatrix (1.0 - 1)
com.apple.MetalPerformanceShaders.MPSNeuralNetwork (1.0 - 1)
com.apple.MetalPerformanceShaders.MPSRayIntersector (1.0 - 1)
com.apple.MetalPerformanceShaders.MetalPerformanceShaders (1.0 - 1)
com.apple.ModelIO (1.0 - 1)
com.apple.NetFS (6.0 - 4.0)
com.apple.Network (1.0 - 1)
com.apple.OSAKit (1.5 - 107)
com.apple.audio.OpenAL (1.8 - 1.8)
unorm8_bgra.dylib (2.9.3)
unorm8_rgba.dylib (2.9.3)
unorm8_rgx.dylib (2.9.3)
libcldcpuengine.dylib (2.9.3)
com.apple.opencl (2.8.20 - 2.8.20)
com.apple.CFOpenDirectory (10.14 - 207.50.1)
com.apple.OpenDirectory (10.14 - 207.50.1)
libCVMSPluginSupport.dylib (17.0.26)
libCoreFSCache.dylib (163.16)
libCoreVMClient.dylib (163.16)
libGFXShared.dylib (17.0.26)
libGL.dylib (17.0.26)
libGLImage.dylib (17.0.26)
libGLU.dylib (17.0.26)
com.apple.opengl (17.0.26 - 17.0.26)
org.python.python (2.7.10 - 2.7.10)
com.apple.QTKit (7.7.3 - 3026.1)
com.apple.imageKit (3.0 - 1058)
com.apple.PDFKit (1.0 - 721.1.1)
com.apple.QuartzComposer (5.1 - 368)
com.apple.quartzfilters (1.10.0 - 1.10.0)
com.apple.QuickLookUIFramework (5.0 - 765.6)
com.apple.quartzframework (1.5 - 21)
com.apple.QuartzCore (1.11 - 658.2)
com.apple.QuickLookFramework (5.0 - 765.6)
com.apple.SafariServices.framework (14606 - 14606.1.17.40.4)
com.apple.SceneKit (1.0 - 456.4)
com.apple.ScriptingBridge (1.4 - 74)
com.apple.security (7.0 - 58286.200.129.11.2)
com.apple.securityfoundation (6.0 - 55185.200.14)
com.apple.securityinterface (10.0 - 55109.200.5)
com.apple.xpc.ServiceManagement (1.0 - 1)
com.apple.SpriteKit (1.0 - 1)
com.apple.SystemConfiguration (1.17 - 1.17)
com.apple.VideoToolbox (1.0 - 2280.60.8.2)
libwebrtc.dylib (7606.1.17.40.4)
com.apple.WebCore (14606 - 14606.1.17.40.4)
com.apple.WebKitLegacy (14606 - 14606.1.17.40.4)
com.apple.WebKit (14606 - 14606.1.17.40.4)
com.apple.APFS (1.0 - 1)
com.apple.accessibility.AXCoreUtilities (1.0 - 1)
com.apple.AddressBook.core (1.0 - 1)
com.apple.AnnotationKit (1.0 - 232.3.15)
com.apple.AppContainer (4.0 - 360.200.11.10.2)
com.apple.AppSandbox (4.0 - 360.200.11.10.2)
com.apple.AppSupportUI (1.0 - ???)
com.apple.framework.Apple80211 (13.0 - 1375.5)
com.apple.AppleFSCompression (96.200.2 - 1.0)
com.apple.AppleIDAuthSupport (1.0 - 1)
com.apple.AppleJPEG (1.0 - 1)
com.apple.AppleLDAP (10.14 - 46.200.2)
com.apple.aps.framework (4.0 - 4.0)
com.apple.AppleSRP (5.0 - 1)
com.apple.applesauce (1.0 - ???)
com.apple.AppleSystemInfo (3.1.5 - 3.1.5)
com.apple.AppleVAFramework (5.0.43 - 5.0.43)
com.apple.AssertionServices (1.0 - 1)
com.apple.AuthKit (1.0 - 1)
com.apple.AuthKitUI (1.0 - 1)
com.apple.coreservices.BackgroundTaskManagement (1.0 - 57.1)
com.apple.backup.framework (1.10 - ???)
com.apple.BaseBoard (360.12.1 - 360.12.1)
com.apple.BezelServicesFW (310 - 310)
com.apple.bom (14.0 - 195)
com.apple.CacheDelete (1.0 - 1)
com.apple.CalendarAgentLink (8.0 - 250)
com.apple.ChunkingLibrary (194 - 194)
com.apple.CommerceCore (1.0 - 708.0.29.2)
com.apple.CommonAuth (4.0 - 2.0)
com.apple.commonutilities (8.0 - 900)
com.apple.framework.ConfigurationProfiles (11.0 - 1106)
com.apple.AddressBook.ContactsFoundation (8.0 - ???)
com.apple.contacts.ContactsPersistence (1.0 - ???)
com.apple.CoreAUC (265.0.0 - 265.0.0)
com.apple.CoreAVCHD (6.0.0 - 6000.4.1)
com.apple.CoreAnalytics.CoreAnalytics (1.0 - 1)
com.apple.corebrightness (1.0 - 1)
com.apple.frameworks.CoreDaemon (1.3 - 1.3)
com.apple.CoreEmoji (1.0 - 69.15.5)
com.apple.CoreHandwriting (161 - 1.2)
com.apple.CoreMediaAuthoring (2.2 - 958)
com.apple.CoreNLP (1.0 - 130.15.15)
com.apple.CoreOptimization (1.0 - 1)
com.apple.CorePDF (4.0 - 414)
com.apple.CorePhoneNumbers (1.0 - 1)
com.apple.CorePrediction (1.0 - 1)
com.apple.CoreServicesInternal (355 - 355)
com.apple.CoreSymbolication (10.0 - 64224)
com.apple.CoreThemeDefinition (2.0 - 346.15)
com.apple.coreui (2.1 - 498.23)
com.apple.CoreUtils (5.7 - 570.33)
com.apple.framework.CoreWiFi (13.0 - 1370.5)
com.apple.CrashReporterSupport (10.13 - 1)
com.apple.framework.DFRFoundation (1.0 - 206)
com.apple.DSExternalDisplay (3.1 - 380)
com.apple.datadetectors (5.0 - 382)
com.apple.datadetectorscore (7.0 - 590.12)
com.apple.DebugSymbols (183 - 183)
com.apple.desktopservices (1.13 - ???)
com.apple.DeviceLinkX (5.0 - 264)
com.apple.diagnosticlogcollection (10.0 - 1000)
com.apple.DiskImagesFramework (480.200.9 - 480.200.9)
com.apple.DiskManagement (12.0 - 1517.1)
com.apple.DisplayServicesFW (3.1 - 380)
com.apple.SystemConfiguration.EAP8021X (14.0.0 - 14.0)
com.apple.EFILogin (2.0 - 2)
com.apple.Engram (1.0 - 1)
com.apple.vision.EspressoFramework (1.0 - 107)
com.apple.vision.FaceCore (3.3.3 - 3.3.3)
com.apple.framework.familycontrols (4.1 - 410)
com.apple.GPUWrangler (3.22.9 - 3.22.9)
com.apple.GenerationalStorage (2.0 - 285.101)
com.apple.GeoServices (1.0 - 1365.20.5.10.5)
com.apple.GraphVisualizer (1.0 - 5)
com.apple.GraphicsServices (1.0 - 1.0)
com.apple.Heimdal (4.0 - 2.0)
com.apple.IASUtilities (1.0 - 497)
com.apple.ids (10.0 - 1000)
com.apple.idsfoundation (10.0 - 1000)
com.apple.imfoundation (10.0 - 1000)
com.apple.IOAccelerator (400.12.2 - 400.12.2)
com.apple.IOPlatformPluginFamily (1.0 - 1)
com.apple.IOPresentment (1.0 - 37)
com.apple.IconServices (262.1 - 365.2.1)
com.apple.InternationalSupport (1.0 - 10.15.3)
com.apple.IntlPreferences (2.0 - 227.15.2)
com.apple.Jet (1.0 - 1)
com.apple.security.KeychainCircle.KeychainCircle (1.0 - 1)
com.apple.LanguageModeling (1.0 - 159.15.10)
com.apple.Lexicon-framework (1.0 - 33.15.7)
com.apple.LinguisticData (1.0 - 260)
com.apple.LoggingSupport (1.0 - 906.200.52.10.1)
com.apple.LoginUICore (4.0 - 4.0)
com.apple.LookupFramework (1.2 - 246)
com.apple.Mangrove (1.0 - 1)
com.apple.marco (10.0 - 1000)
com.apple.MarkupUI (1.0 - 232.3.15)
com.apple.MediaKit (16 - 903)
com.apple.MediaRemote (1.0 - 1)
com.apple.MediaServices (1.0 - 1)
com.apple.spotlight.metadata.utilities (1.0 - 1191.23.3)
com.apple.gpusw.MetalTools (1.0 - 1)
com.apple.MobileAssets (1.0 - 437.200.22.10.4)
com.apple.mobiledevice (988.220.5 - 988.220.5)
com.apple.MobileKeyBag (2.0 - 1.0)
com.apple.Montreal (1.0 - 42.15.7)
com.apple.MultitouchSupport.framework (2000.21 - 2000.21)
com.apple.Navigation (1.0 - 1)
com.apple.NetAuth (6.2 - 6.2)
com.apple.network.statistics.framework (1.2 - 1)
com.apple.PackageKit (3.0 - 813.3)
com.apple.PencilKit (1.0 - 1)
com.apple.PerformanceAnalysis (1.207 - 207)
com.apple.PhoneNumbers (1.0 - 1)
com.apple.PhysicsKit (1.0 - 1)
com.apple.pluginkit.framework (1.0 - 1)
com.apple.PowerLog (1.0 - 1)
com.apple.ProtectedCloudStorage (1.0 - 1)
(1 - 263)
com.apple.QuickLookNonBaseSystem (1.0 - 1)
com.apple.QuickLookThumbnailing (1.0 - 1)
com.apple.ROCKit (17 - 17)
com.apple.xpc.RemoteServiceDiscovery (1.0 - 1336.200.58.10.2)
com.apple.RemoteViewServices (2.0 - 126)
com.apple.xpc.RemoteXPC (1.0 - 1336.200.58.10.2)
com.apple.Safari.SafeBrowsing (606 - 606.1.17.40.4)
com.apple.SecCodeWrapper (4.0 - 360.200.11.10.2)
com.apple.Sharing (1121.1 - 1121.1)
com.apple.framework.sidecar-core (1.0 - 20)
com.apple.performance.SignpostNotification (1.10 - 10)
com.apple.SkyLight (1.600.0 - 336.42.5)
com.apple.SpeechRecognitionCore (5.0.20 - 5.0.20)
com.apple.spotlight.index (10.7.0 - 1191.23.3)
com.apple.StorageManagement (1.0 - 1)
com.apple.StreamingZip (1.0 - 1)
com.apple.Symbolication (10.0 - 64234.1)
com.apple.framework.SystemAdministration (1.0 - 1.0)
com.apple.TCC (1.0 - 1)
com.apple.TextureIO (3.8.1 - 3.8.1)
com.apple.ToneKit (1.0 - 1)
com.apple.ToneLibrary (1.0 - 1)
com.apple.TrustEvaluationAgent (2.0 - 31)
com.apple.UIFoundation (1.0 - 550.19)
com.apple.URLFormatting (59 - 59.28)
com.apple.Uninstall (1.0.1 - 211)
libUAPreferences.dylib (361.33.1)
com.apple.VectorKit (1.0 - 1361.20.5.10.3)
com.apple.ViewBridge (379.1.1 - 379.1.1)
libAWDSupportFramework.dylib (848)
libprotobuf-lite.dylib (848)
libprotobuf.dylib (848)
com.apple.awd (1.0 - 930.8)
com.apple.private.XprotectFrameWork.XprotectFramework (1.0 - 1)
com.apple.kperf (1.0 - 1)
com.apple.loginsupport (1.0 - 1)
com.apple.login (3.0 - 3.0)
com.apple.contacts.vCard (1.0 - ???)
libAccessibility.dylib (2401.52.3)
libCRFSuite.dylib (41.15.4)
libChineseTokenizer.dylib (28.15.3)
libCoreStorage.dylib (546.50.1)
libDiagnosticMessagesClient.dylib (105)
libFosl_dynamic.dylib (18.3.2)
libMatch.1.dylib (31)
libMobileGestalt.dylib (645.200.47.10.1)
libOpenScriptingUtil.dylib (176)
libSystem.B.dylib (1252.200.5)
libTelephonyUtilDynamic.dylib (3595)
libThaiTokenizer.dylib (2.15.1)
libUniversalAccess.dylib (361.33.1)
libapple_nghttp2.dylib (1.24.1)
libarchive.2.dylib (54.200.2)
libate.dylib (1.13.7)
libauto.dylib (187)
libboringssl.dylib (109.200.20)
libbsm.0.dylib (39.200.15)
libbz2.1.0.dylib (38.200.3)
libc++.1.dylib (400.9.3)
libc++abi.dylib (400.15)
libcharset.1.dylib (51.200.3.10.1)
libcmph.dylib (6.15.1)
libcompression.dylib (52.200.11)
libcoretls.dylib (155.200.6)
libcoretls_cfhelpers.dylib (155.200.6)
libcrypto.35.dylib (22.200.2)
libcrypto.42.dylib (22.200.2)
libcsfde.dylib (546.50.1)
libcups.2.dylib (462.5)
libcurl.4.dylib (105.200.2)
libdtrace.dylib (284.200.12)
libdz.dylib (1.0.0 - 110.200.39.0.1)
libedit.3.dylib (50.200.2)
libenergytrace.dylib (17.200.1)
libexslt.0.dylib (16.1)
i.dylib (18.1)
libgermantok.dylib (17.15.2)
libheimdal-asn1.dylib (520.200.9)
libiconv.2.dylib (51.200.3.10.1)
libicucore.A.dylib (61105.0.1)
liblangid.dylib (128.15.1)
liblzma.5.dylib (10.200.3)
libmecab.1.0.0.dylib (779.15.14)
libmecabra.dylib (779.15.14)
libncurses.5.4.dylib (53.200.3)
libnetwork.dylib (1229.200.74.10.1)
libnetworkextension.dylib (767.200.25.10.1)
libobjc.A.dylib (744)
libodfde.dylib (24.50.1)
libpam.2.dylib (22)
libpanel.5.4.dylib (53.200.3)
libpcap.A.dylib (79.200.4)
libquit.dylib (258)
libresolv.9.dylib (65.200.2)
libsandbox.1.dylib (851.200.80.11.2)
libsasl2.2.dylib (211)
libspindump.dylib (258)
libsqlite3.dylib (274.15)
libssl.35.dylib (22.200.2)
libssl.44.dylib (22.200.2)
libstdc++.6.dylib (104.1)
libsysmon.dylib (100)
libtidy.A.dylib (16.1)
libusrtcp.dylib (1229.200.74.10.1)
libutil.dylib (51.200.3)
libxar.1.dylib (402.1)
libxml2.2.dylib (32.5)
libxslt.1.dylib (16.1)
libz.1.dylib (70.200.4)
libcache.dylib (81)
libcommonCrypto.dylib (60118.200.5)
libcompiler_rt.dylib (63.4)
libcopyfile.dylib (146.200.1)
libcorecrypto.dylib (602.200.31)
libdispatch.dylib (1008.200.56)
libdyld.dylib (620.3)
libkeymgr.dylib (30)
libkxld.dylib (4903.200.199.11.1)
liblaunch.dylib (1336.200.58.10.2)
libmacho.dylib (914)
libquarantine.dylib (86.200.5.10.1)
libremovefile.dylib (45.200.2)
libsystem_asl.dylib (356.200.3)
libsystem_blocks.dylib (73)
libsystem_c.dylib (1272.200.20)
libsystem_configuration.dylib (963.200.17)
libsystem_containermanager.dylib (136.200.27)
libsystem_coreservices.dylib (62)
libsystem_darwin.dylib (1272.200.20)
libsystem_dnssd.dylib (878.200.16)
libsystem_info.dylib (517.200.7)
libsystem_kernel.dylib (4903.200.199.11.1)
libsystem_m.dylib (3158.200.6)
libsystem_malloc.dylib (166.200.39.10.1)
libsystem_networkextension.dylib (767.200.25.10.1)
libsystem_notify.dylib (172.200.9.10.2)
libsystem_platform.dylib (177.200.7)
libsystem_pthread.dylib (330.200.30)
libsystem_sandbox.dylib (851.200.80.11.2)
libsystem_secinit.dylib (30.200.3)
libsystem_symptoms.dylib (820.207.59)
libsystem_trace.dylib (906.200.52.10.1)
libunwind.dylib (35.4)
libxpc.dylib (1336.200.58.10.2)
Model: VMware7,1, BootROM VMW71.00V.9694812.B64.1808210100, 4 processors, 3.05 GHz, 10.26 GB, SMC 1.16f8
Graphics: Display, 3 MB
Memory Module: RAM slot #0/RAM slot #0, 8 GB, DRAM, 0 MHz, VMware Virtual RAM, VMW-8192MB
Memory Module: RAM slot #1/RAM slot #1, 2 GB, DRAM, 0 MHz, VMware Virtual RAM, VMW-2048MB
Memory Module: RAM slot #2/RAM slot #2, 256 MB, DRAM, 0 MHz, VMware Virtual RAM, VMW-256MB
Memory Module: RAM slot #3/RAM slot #3, 8 MB, DRAM, 0 MHz, VMware Virtual RAM, VMW-8MB
Memory Module: RAM slot #4/RAM slot #4, 4 MB, DRAM, 0 MHz, VMware Virtual RAM, VMW-4MB
Network Service: Ethernet, Ethernet, en0
Serial ATA Device: VMware Virtual SATA Hard Drive, 107.37 GB
Serial ATA Device: VMware Virtual SATA CDRW Drive
USB Device: USB 2.0 Bus
USB Device: USB 3.0 Bus
USB Device: VMware Virtual USB Hub
USB Device: VMware Virtual USB Hub
USB Device: VMware Virtual USB Keyboard
USB Device: VMware Virtual USB Mouse
USB Device: USB Bus
Thunderbolt Bus:
Maybe it detects if the user is on a virtual machine and they intentionally crash their software .. I had exactly the same problem when I updated xcode, so I returned to xcode 10.0 and it works. I use the latest version of mac os: Mojav and my system is up to date.

Mat file loads slower than m-file

I have a large variable stored in a mat file and in a .m file.
The data is just a big cell:
Tensor{1,1,1,1,1,1,1,1,1,1,1,1}=[1,1,2,2,1, (... )];
Tensor{1,1,1,1,1,1,1,1,1,1,1,2}=[1,1,2,2,3, (... )];
(...)
Why it is so much slower to load the variable form the mat-file, than from the m-file?
tic;load('Tensor.mat');toc
Elapsed time is 6.969654 seconds.
tic;Tensor;toc
Elapsed time is 0.152476 seconds.
Is there a way to save variables as m-files?
#Daniel An example of a typical entry is:
Tensor{2,2,2,2,2,4,4,4,4,4,4,4} = [ ...
0,0,0,0,0,(1 / 6) .* 22 .^ (-1 / 2),0,0,0,0,0,0,0 ; ...
0,0,0,0,(1 / 6) .* ( 5 / 33) .^ (1 / 2),0,(-1 / 12) .* (7 / 11) .^ (1 / 2),0,0,0,0,0,0 ; ...
0,0,0, (1 / 11) .* (5 / 6) .^ (1 / 2),0,(-35 / 132) .* 3 .^ (-1 / 2),0,(7 / 44) .* 3 .^ (-1 / 2),0,0,0,0,0; ...
0,0,(1 / 11) .* (5 / 6) .^ (1 / 2),0,(-7 / 33),0,(1 / 44) .* 105 .^ (1 / 2),0,(-7 / 66),0,0,0,0; ...
0,(1 / 6) .* (5 / 33) .^ (1 / 2),0,(-7 / 33),0,(7 / 33) .* (5 / 2) .^ (1 / 2),0,(-35 / 198) .* (5 / 2) .^ (1 / 2),0,(7 / 66),0,0,0; ...
(1 / 6) .* 22 .^ (-1 / 2),0,(-35 / 132) .* 3 .^ (-1 / 2),0,(7 / 33) .* (5 / 2) .^ (1 / 2),0,(-25 / 66) .* (7 / 6) .^ (1 / 2),0,(35 / 198) .* (5 / 2) .^ (1 / 2),0,(-7 / 44) .* 3 .^ (-1 / 2),0,0; ...
0,(-1 / 12) .* (7 / 11) .^ (1 / 2),0,(1 / 44) .* 105 .^ (1 / 2),0,(-25 / 66) .* (7 / 6) .^ (1 / 2),0,(25 / 66) .* (7 / 6) .^ (1 / 2),0,(-1 / 44) .* 105 .^ (1 / 2),0,(1 / 12) .* (7 / 11) .^ (1 / 2),0; ...
0,0,(7 / 44) .* 3 .^ (-1 / 2),0,(-35 / 198) .* (5 / 2) .^ (1 / 2) ,0,(25 / 66) .* (7 / 6) .^ (1 / 2),0,(-7 / 33) .* (5 / 2) .^ (1 / 2),0,( 35 / 132) .* 3 .^ (-1 / 2),0,(-1 / 6) .* 22 .^ (-1 / 2); ...
0,0,0,(-7 / 66), 0,(35 / 198) .* (5 / 2) .^ (1 / 2),0,(-7 / 33) .* (5 / 2) .^ (1 / 2),0,( 7 / 33),0,(-1 / 6) .* (5 / 33) .^ (1 / 2),0; ...
0,0,0,0,(7 / 66),0,(-1 / 44) .* 105 .^ (1 / 2),0,(7 / 33),0,(-1 / 11) .* (5 / 6) .^ (1 / 2),0,0; ...
0,0,0,0,0,(-7 / 44) .* 3 .^ (-1 / 2),0,(35 / 132) .* 3 .^ (-1 / 2),0,(-1 / 11) .* (5 / 6) .^ (1 / 2),0,0,0; ...
0,0,0,0,0,0,(1 / 12) .* (7 / 11) .^ (1 / 2),0,(-1 / 6) .* (5 / 33) .^ (1 / 2),0,0,0,0; ...
0,0,0,0,0,0,0,(-1 / 6) .* 22 .^ (-1 / 2),0,0,0,0,0 ...
] ;
That is because the .mat-file is a binary file that requires some processing to extract a variable, while the .m-file is nothing else just a text file. Instead of .m-file it is more convenient to save data in .dat-file. The result should be about the same. This can be checked trying these two commands:
tic;load('Tensor.mat');toc
tic;load('Tensor.dat','-ascii');toc

Multiplying constant to an expression

I am multiplying constant to an expression which can be seen from below. But the final expression is getting reduced. I just want it to be multiplied.
(x^2 (-((1. (2 - 1/x)^3 x^5)/(
Sqrt[1 - x^2] (0. + 1. x^2)^1.5)) + ((2 - 1/x)^3 x^5)/((1 - x^2)^(
3/2) (0. + 1. x^2)^0.5) + (3 (2 - 1/x)^2 x^2)/(
Sqrt[1 - x^2] (0. + 1. x^2)^0.5) + (4 (2 - 1/x)^3 x^3)/(
Sqrt[1 - x^2] (0. + 1. x^2)^0.5)))/(3 (2 - 1/x)^2) * (4)
Kindly help. Thanks in advance.
It simplifies ok.
expr = (x^2 (-((1. (2 - 1/x)^3 x^5)/
(Sqrt[1 - x^2] (0. + 1. x^2)^1.5)) +
((2 - 1/x)^3 x^5)/
((1 - x^2)^(3/2) (0. + 1. x^2)^0.5) +
(3 (2 - 1/x)^2 x^2)/
(Sqrt[1 - x^2] (0. + 1. x^2)^0.5) +
(4 (2 - 1/x)^3 x^3)/
(Sqrt[1 - x^2] (0. + 1. x^2)^0.5)))/
(3 (2 - 1/x)^2)*(4);
Simplify[expr] // InputForm
(-2.6666666666666665*x^4*(-1.5*x^6*(x^2)^0.5 + 1.x^7(x^2)^0.5 + 1.5*x*(x^2)^1.5 -
4.5*(x^2)^2.5 + x^5*(-0.25*(x^2)^0.5 - 3.(x^2)^1.5) +
x^4(1.375*(x^2)^0.5 + 3.(x^2)^1.5) + x^3(-0.75*(x^2)^0.5 + 3.25*(x^2)^1.5)))/
((0.5 - 1.x)^2(x^2)^2.Sqrt[1 - x^2](-1. + x^2))

Function to return 3^k in n+1 calls

Can someone hep me find an algorithm for a recursive function func(int k) to return 3^k in only n+1 calls where k is in the range [ 3^n, 3^(n+1) )
For example, the function should return 3^1 or 3^2 in 1 call, 3^3, 3^4, .., 3^8 in 2 calls, 3^9, 3^10 .. in 3 calls and so on.
Here is the algorithm in untested C/C++:
int 3pow(x)
{
switch(x)
{
case 1: return 3;
case 2: return 9;
case 3: return 27;
}
int remain = x % 3,
recur = 3pow((x-remain)/3),
combine = recur * recur * recur;
switch (remain)
{
case 0: return combine;
case 1: return combine * 3;
default: return combine * 9;
}
}
(I have not compiled, run, or otherwise tested this code. There may be syntax errors and other bugs. But it's sufficient to get the point across.)
What's different about this algorithm is that it recurses by dividing by 3 instead of 2. This function is rather ugly by necessity, as abstracting away some of the pattern would likely involve more recursion. Still, this algorithm is now O(log3n). Here's a table of a given x from 1-50 and the number of recursive calls required (as a two-element lisp list):
(1 1) (2 1) (3 1) (4 2) (5 2) (6 2) (7 2) (8 2) (9 2) (10 2)
(11 2) (12 3) (13 3) (14 3) (15 3) (16 3) (17 3) (18 3) (19 3) (20 3)
(21 3) (22 3) (23 3) (24 3) (25 3) (26 3) (27 3) (28 3) (29 3) (30 3)
(31 3) (32 3) (33 3) (34 3) (35 3) (36 4) (37 4) (38 4) (39 4) (40 4)
(41 4) (42 4) (43 4) (44 4) (45 4) (46 4) (47 4) (48 4) (49 4) (50 4)
(51 4) (52 4) (53 4) (54 4) (55 4) (56 4) (57 4) (58 4) (59 4) (60 4)
(61 4) (62 4) (63 4) (64 4) (65 4) (66 4) (67 4) (68 4) (69 4) (70 4)
(71 4) (72 4) (73 4) (74 4) (75 4) (76 4) (77 4) (78 4) (79 4) (80 4)
(81 4) (82 4) (83 4) (84 4) (85 4) (86 4) (87 4) (88 4) (89 4) (90 4)
(91 4) (92 4) (93 4) (94 4) (95 4) (96 4) (97 4) (98 4) (99 4) (100 4)
You can see that even as we get up over 100 it only take 4 recursive calls.

Resources