-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matlab MEX function #1
base: master
Are you sure you want to change the base?
Conversation
@smorosohk I see that you have re-coded the c library in your matlab MEX functions. Please see if you can just link to the Concerning the issue that you are seeing, getting 10 outputs instead of the 18 outputs that you expect from EPED1-NN... my suspicion is that somehow you are mixing up inputs (of which there are 10) and outputs. Please check if that's the case somewhere. |
I did originally attempt to link brainfusetf_lib to the MEX function, and was getting errors that it did not link correctly. It was simpler to copy the function definitions into the MEX function. I don't believe that I am mixing up inputs and outputs. I am using 10 inputs, and the 10 outputs that I am getting are the same values as the first 10 outputs when I run brainfusetf_run.exe from the terminal. I have also hardcoded 18 as the number of outputs I should be getting from the btf_run function (Call_EPED_NN.c line 248). |
@smorosohk can you please try to change the number of tries that are done at this line: https://github.com/gafusion/neural/blob/master/brainfusetf_lib.c#L133 Any difference? |
When I run that for loop more than 10 times it causes MATLAB to crash. I get the "error on read" error message from ReadXBytes and I am forced to restart MATLAB. |
It looks like I was initializing the output array with a size of 10. I am now getting an output vector of the correct length, but MATLAB is still crashing on this line: Line 158 in e5fc175
I'm guessing the issue is coming from pToken, which is a constant 1.4429 (equal to the last input). Is message1 not being parsed correctly in line 156? I am also still getting error on read from this line: Line 145 in e5fc175
|
I figured out how to get all of the outputs and not have MATLAB crash. The version in the matlab -1 branch is calling EPED correctly from MATLAB. Can you tell me where to find the .pb file for the TGLF model so I can work on calling that from MATLAB? |
@smorosohk with b0d7f8e I have added the TGLF models. You want to use the 2IONS model for DIII-D. |
Thank you Orso. Does the 2IONS model have the same 23 inputs and 4 outputs as the model in your paper? |
I think it has 23 inputs and 5 outputs (I added the carbon particle flux since the paper). Use the info function to see what these are. |
I have not actually been able to get the .info() function to work. As far as I can tell it is not a C function so it does not work in my MEX function. It is a python function, but I'm not actually running anything in python and when I try to run it from the terminal it does not work. |
Can you try running the |
I get a permission denied error. |
how are you running the script? Are you doing |
I was running python first and then the script. If I run them in the same line I get "No module named SocketServer" |
This looks like to be an issue with the python that you have on the system that you are running. Do you have access to the module load omfit
cd DIRECTORY_WHERE_YOU_HAVE_NEURAL_INSTALLED
python tf_client_server_test.py |
That worked from iris, thank you. I'm not sure what the issue was on my computer, but if I can access the info on iris that's all I need. |
👍 |
I have both the EPED and TGLF neural nets working from MATLAB, and have uploaded them to the matlab-1 branch. |
Binary files should not be uploaded
Do not add binary files
Do not add binary files
Do not add binary files
Do not add backup files
@smorosohk |
This is excellent progress, but I still have an issue with the brainfuse library being copied an pasted in the matlab function source code. @smorosohk can you try one more time to avoid doing that. I think all you need to do is pass the path to the |
@orso82 It may need a dynamic library instead of a static one. |
@smorosohk I have updated the Makefile to generate dynamic libraries. If you do a |
I haven't been able to set up the fann library on my personal computer, so when I try to run make all I get an error message that the file 'fann.h' was not found. I tried to set it up the same way I did on my office computer before that computer died, which worked, but for some reason it does not work on my personal computer. |
Are you using the FANN models at all? |
I was, I got the EPED FANN model to work in MATLAB before my office computer died. Having to write the inputs to a file takes longer to run, so I've been focusing on the TENSORFLOW models. |
If you are not using the FANN models, than you should be able to generate the dynamic library for the tensorflow models by running |
I was able to make the libbrainfusetf files, but I have still not been able to link them to the MEX functions. I have tried every way I can think of -both in the source code and when compiling- to link to libbrainfusetf.a, and the MEX function stops even attempting to compile after it hits 20 errors. I know that copying all of the function definitions is not the best coding practice, but it is the only way I can see to make the MEX functions compile. |
@smorosohk Can you post the errors you are encountering when trying to link the lib files to the MEX files? |
I am getting over 400 warnings, literally on every character of libbrainfusetf.a, most of which are "warning: null character ignored [-Wnull-character]". Most of the 20 errors are "error: source file is not valid UTF-8" |
What is the command to generate the mex library? |
mex Call_EPED_NN.c I have tried linking libbrainfusetf.a in the generation command using |
Based on a standard compiler/linker, I would have guessed
What does that return? |
I get the same errors. |
Call the EPED FANN and TENSORFLOW neural nets from MATLAB