MCX Cloud pattern source error and parsererror

204 views
Skip to first unread message

Ife E

unread,
Oct 24, 2023, 10:26:47 AM10/24/23
to mcx-users
Dear Prof. Fang,

I'm currently using (or trying to) MCX cloud to simulate light propagation through a homogenous phantom and compare the results to an imaging setup I have in the lab.

Initially I was using a pattern source using a normalised image of my beam profile but MCX cloud throws an error saying my srcpattern field is empty. This was for job ID 5A901A06A32775E53F4A3AA434551EE6AF2BEB57. Currently I am defining a cfg struct in MATLAB and then converting to json with mcx2json.m.

I then repeated the simulation changing the source to a pencil and instead hoping to just convolve the output with the pattern source (Job ID 6AD4DC0411701CE717DE98A637D21E2BD33A6E02) but instead MCX cloud throws the below error message

"jobstatus error: parsererror"

Any help would be really appreciated

Thanks,
Ife



Qianqian Fang

unread,
Oct 24, 2023, 8:57:25 PM10/24/23
to mcx-...@googlegroups.com, Ife E

hi Ife,

thanks for reporting this. I was able to retrieve both of your problematic simulations using the provided job IDs, and here is what I found:


1. for your first job (using pattern source), although the mcx docker image used in the backend of mcxcloud does support pattern source, the front-end of mcxcloud - i.e. the in-browser json editor, however, does not currently support this input JSON field. the mcxcloud javascript uses JSON schema to define what it allows users to use, here is the JSON schema for the supported "Optode.Source" field:

https://github.com/fangq/mcx/blob/v2023/mcxcloud/frontend/index.html#L767-L870

as you can see, the "Pattern" field is not defined here. so, when you paste your locally generated JSON file to the editor, and click the "Update Form", the editor will automatically remove this field as it is not defined in the schema.

To fix this, I will need to define the schema for this data field, which is possible. Give me some time and I will add this support (possibly next week).


2. for your second job, "pencil beam", mcx cloud actually completed the job quickly. However, your simulation has a somewhat large domain of 300x300x40 voxels and 100x time gates. This produced a huge data file (30MB .jnii after compression, 1.5GB before compression).

although the mcxcloud javascript frontend was able to download the 30MB compressed .jnii output, but the decompression using javascript consumes a huge amount of resources (>6GB memory) and eventually chrome killed the tab.

this is just an example showing that doing simulations in the browser is still have limits. try not to use large sized domains, try not to use many time gates. your browser is still not quite as powerful as running mcx locally.


Qianqian

--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/2b4ec6f1-88ed-4f1f-b3a5-5b17302ddb21n%40googlegroups.com.

Qianqian Fang

unread,
Oct 24, 2023, 11:03:51 PM10/24/23
to mcx-...@googlegroups.com, Ife E

hi Ife,

I just updated json schema to support "Pattern" field under Optode.Source.

https://github.com/fangq/mcx/commit/db608f7a842a3ee078ba8f281ea1b02e142b511b#diff-842a96e4604ec9ff39875b916c9bb0a373e08fa9bf1552463aa84d977bdb5aedR292

the mcxcloud website has also been updated. when you paste JSON including pattern data (must be in JData array format - requiring _ArrayType_/_ArraySize_/_ArrayZipType_/_ArrayZipSize_/_ArrayZipData_ fields, where _ArrayType_ must be "single" and _ArrayZipType_ must be "zlib"), mcx cloud should be able to accept it and submit.

along with this update, I also removed all optional elements in the default JSON template (previously, all supported JSON fields are listed). you need to check a checkbox to enable an optional element in order to use it. I am not sure if this has any side effect. If anyone sees a problem, please let me know.

Qianqian

Ife E

unread,
Oct 25, 2023, 1:01:20 PM10/25/23
to mcx-users

Hi  Qianqian,

Thanks for your help. I'll have a look at how I can reduce the memory requirements for what I need to to simulate.

Ife

半竹

unread,
Jan 16, 2024, 11:41:54 AM1/16/24
to mcx-users
Dear Prof. Fang, 

I try the demo but it returns 'jobstatus error: parsererror'
This is my job id: 8A75B5515D856942E146A51C1C72D4C371D64C8C
Thank you so much!

Qianqian Fang

unread,
Jan 16, 2024, 11:48:10 AM1/16/24
to mcx-...@googlegroups.com, 半竹

I looked up your job ID, and noticed that the submitted job is just the built in skinvessel example. can you confirm if this is the case?

when I resubmit the json settings for the same benchmark, mcxcloud correctly identified that this is a cached simulation and immediately returned the cached results, which is expected



11:44:54 AM Successfully submitted job AC5E525937EC627923C4FD0BFE6391C0EBD47CDF
11:45:03 AM use cached data
11:45:03 AM log
 ###############################################################################
 #                      Monte Carlo eXtreme (MCX) -- CUDA                      #
 #          Copyright (c) 2009-2020 Qianqian Fang <q.fang at neu.edu>          #
 #                             http://mcx.space/                               #
 #                                                                             #
 # Computational Optics & Translational Imaging (COTI) Lab- http://fanglab.org #
 #   Department of Bioengineering, Northeastern University, Boston, MA, USA    #
 ###############################################################################
 #    The MCX Project is funded by the NIH/NIGMS under grant R01-GM114365      #
 ###############################################################################
 $Rev::0313d4$ v2020 $Date::2020-09-06 23:25:03 -04$ by $Author::Qianqian Fang $
 ###############################################################################
 - variant name: [Fermi] compiled by nvcc [9.0] with CUDA [9000]
 - compiled with: RNG [xorshift128+] with Seed Length [4]
 
 GPU=1 (GeForce GTX 1080) threadph=24 extra=16960 np=1000000 nthread=40960 maxgate=1 repetition=1
 initializing streams ...    init complete : 5 ms
 requesting 1024 bytes of shared memory
 launching MCX simulation for time window [0.00e+00ns 5.00e+01ns] ...
 simulation run# 1 ...
 kernel complete:      645 ms
 retrieving fields ...     transfer complete:    655 ms
 normalizing raw data ...    source 1, normalization factor alpha=0.040000
 data normalization complete : 794 ms
 saving data to file ...    saving data complete : 2593 ms
 
 simulated 1000000 photons (1000000) with 40960 threads (repeat x1)
 MCX simulation speed: 1582.28 photon/ms
 total simulated energy: 1000000.00    absorbed: 39.72081%
 (loss due to initial specular reflection is excluded in the total)
11:45:03 AM output data received

半竹

unread,
Jan 16, 2024, 8:42:53 PM1/16/24
to mcx-users
Dear Prof. Fang, 

Yes, I tried the skinvessel example you used in tutorial1, but the job status returned in job status does not match the video. I'm confused, I switched two computers and the same thing happened, do I need to install any plugin? Or do I need to configure the computer environment?
Thank you so much! TAT


09:33:52 Successfully submitted job 0C3FA7E93C4D97BB06BAAD0E5A3EC38B8D01AE91
jobstatus error: parsererror
09:34:13 use cached data
09:34:13 log
09:34:13 output data received
09:34:21 use cached data
09:34:21 log
09:34:21 output data received

Echo

半竹

unread,
Jan 16, 2024, 9:07:57 PM1/16/24
to mcx-users
Dear Prof. Fang,

I tried the job again and the job status still shows 'jobstatus error: parsererror' and the 3D rendering in the preview is not complete (I can't see the blood vessel part), I've attached the image, thanks for your help!

09:42:32 Successfully submitted job E4C1387A3C4389768BB2E0CFCEBF47B3804CE763
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror
jobstatus error: parsererror

mcx.png

Qianqian Fang

unread,
Jan 17, 2024, 12:16:17 PM1/17/24
to mcx-...@googlegroups.com, 半竹

you don't need special setup or plugin. mcx cloud should work directly in your browser.

please report your web browser version and OS version. it is possible that the javascript does not work well on your browser. I did most of my tests on Chrome.

if you really want to debug what had triggered this, you can use the Development tools in Chrome (... menu -> More tools -> Development tools), go to the Sources tab on the top, set a break point on line#2457 of the script (click on the js/cloud/ tree view to show source), then submit your simulation. if the error is triggered again, go to the "Network" tab on the top (expand ">>" to see more tabs), and select the last mcxserver.cgi communication and use the Response tab to find out what was returned from the server.

two screenshots are shown here, first show the break point in the source, second shows the mcxserver.cgi response source data.

if the response is simply parsererror, that means the submitted data was invalid JSON, you need to click the mcxserver.cgi link right above the last in the Network tab to see what your browser actually sent in the Payload tab.


半竹

unread,
Jan 18, 2024, 10:18:03 PM1/18/24
to mcx-users
Dear Prof. Fang, 


Thank you for your assistance. I attempted to follow your suggestion by setting breakpoints and examining the information in mcxserver.cgi in developer mode. However, I am not entirely confident in my understanding of how to navigate this process. I have attached images for your reference.

Details of my Chrome browser:
Version: 120.0.6099.225 (Official Build) (64-bit)

OS version:
22621.3007  (64-bit)
Both pieces of information are also included in the attached images.

Once again, thank you for your help!

Echo

1-1.png
1-2.png
2-1.png
1-3.png
1-4.png

3-1.png

3-2.png

Qianqian Fang

unread,
Jan 23, 2024, 12:33:16 PM1/23/24
to mcx-...@googlegroups.com, 半竹

thanks for the screenshots - I still don't have an explanation why this happens in your browser but not mine. looks like the job status update triggered the error() handler and complains it can not find the callback function "addlog()"

I made the following minor code change

https://github.com/fangq/mcx/commit/20b0aa2a0122ba923e8066be1c71c7768ee69715

please try again and let me know if you still see this error.

if you this error still persists, please set the same break-point as you did in the error function as in your screenshots 1-1/1-2/2-1, and switch to the Network tab, and find what did the server responded for that ajax call (in the payload/preview/response tabs)

半竹

unread,
Jan 26, 2024, 1:57:32 AM1/26/24
to mcx-users
Dear Prof. Fang, 
I tried again, but the error still persists. I've attached the screenshots.
Thank you very much.

1-1.png
1-Payload.png
1-Preview.png
1-Response.png

Qianqian Fang

unread,
Jan 29, 2024, 11:11:44 PM1/29/24
to mcx-...@googlegroups.com, 半竹

sorry, I just can't reproduce this error.

Reply all
Reply to author
Forward
0 new messages