20
$\begingroup$

Szabolcs has asked WRI support about mx files, in particular:

  1. Can we expect that MX files written by Mathematica 10.0.0 will be readable by future point released such as 10.0.1 or 10.0.2?

WRI: Yes.

Source: an e-mail and the topic.


And this is true, in V10.3 I can open .mx files generated in V10.2. However, I can't open files from 10.3 in 10.2, getting an error:

DumpGet::bgnew : File ***.mx has been written by a newer version of DumpSave and cannot be loaded.


Why this matters?

Well, Cloud $VersionNumber is still 10.2... so I can't work on my desktop 10.3 with projects that involve cloud interactions with mx files. Or I have to create work arounds from my current setup. Like using 10.2 from time to time or Cloud side DumpSave.

To fit the MMA.SE scheme, let me ask the question. Can I DumpSave from 10.3 so that it is readable on Clound and/or 10.3 desktop MMA?

$\endgroup$
6
  • 6
    $\begingroup$ I think you do know this, but just in case: I tend to use Export[..., Compress[expr], "String"] in place of MX. Then Uncompress@Import[..., "String"]. Usually it's fast enough and much faster than WDX. BTW did I put that in the pastebin? $\endgroup$ – Szabolcs Oct 19 '15 at 10:04
  • $\begingroup$ @Szabolcs Yes, but that's good point. It seems it would be good habit to use this in context of announced more frequent releases and delayed Cloud upgrades. $\endgroup$ – Kuba Oct 19 '15 at 10:06
  • $\begingroup$ I guess the answer is going to be "no" ... But what is your use case? Is it Export-like, i.e. data exchange, or is it DumpSave-like, i.e. save a session with all of its variables/function definitions, and then restore it later? BTW Export works with MX and doesn't require the exported data to be assigned to variables. $\endgroup$ – Szabolcs Oct 19 '15 at 12:12
  • $\begingroup$ @Szabolcs fortunately export-like. $\endgroup$ – Kuba Oct 19 '15 at 12:13
  • 1
    $\begingroup$ Also, WolframCloud will be updated to version 10.3 very soon! $\endgroup$ – Stefan R Oct 21 '15 at 21:47
13
$\begingroup$

No, this is not possible since there is no forward compatibility for MX files. DumpSave will refuse to continue reading the file once it sees it was written by a newer version as demonstrated in the question.

Having said that, there happen to be no changes in the format itself between 10.2 and 10.3, so in principle (after some surgery as shown below to modify the saved version) the file could be made readable by 10.2. But there is no guarantee this will be the case in the future, even between minor releases.

Suppose test.mx was written by version 10.3, then reading it with 10.2 will give an error

Get["test.mx"] 

(* DumpGet::bgnew: File ./test.mx has been written 
   by a newer version of DumpSave and cannot be loaded. >> *)

(* $Failed *)

The following patches the file so it would be readable in 10.2 (use at your own risk)

BinaryWrite["test.mx", ReplacePart[BinaryReadList["test.mx"], 85 -> 2]]

(* "test.mx" *)

The Wolfram Cloud should be updated to 10.3 very soon, as Stefan mentions in the comments.

Update

The cloud is now running "10.3.0 for Linux x86 (64-bit) (October 9, 2015)".

$\endgroup$
4
  • $\begingroup$ Shouldn't there be some kind of temporary forward compatibility due to the fact that Cloud update is delayed? $\endgroup$ – Kuba Oct 21 '15 at 23:06
  • 3
    $\begingroup$ @Kuba Agreed, but unfortunately there is no way to override this without modifying the DumpSave implementation in the kernel and both 10.2 and 10.3 have already shipped. It may be possible to have limited forward compatibility in the future, provided the MX format does not change between consecutive releases. I think the developers are already aware. $\endgroup$ – ilian Oct 21 '15 at 23:20
  • $\begingroup$ I can live with this at the moment so it's good enough that developers will address this issue in future. Thanks. $\endgroup$ – Kuba Oct 22 '15 at 7:09
  • $\begingroup$ I just had the same problem while trying to load the version produced by 11.2 in 11.1.1. Failed. This is quite annoying actually. Would be nice to have a "warning" when makeing the dump! $\endgroup$ – Chen Stats Yu Nov 3 '17 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.