asavine / CompFinance

Companion code for "Modern Computational Finance: AAD and Parallel Simulations" (Antoine Savine, Wiley, 2018)
http://www.amazon.com/gp/product/1119539455
168 stars 61 forks source link

Excel crashes #9

Open lanrez opened 2 years ago

lanrez commented 2 years ago

Whenever I open xlTest.xlsx and try and to calculate the values, Excel crashes and restarts. I am using Microsoft Excel 2016 32-bit on a Intel Corei7 7700HQ GTX 1050Ti Windows 10 Laptop. I have generated the .xll file and can see the myOwnCppFunctions functions in Excel.

mrslezak commented 2 years ago

Same here installed both the x86 and x64 vcredist (updated from Microsoft), I think it's compiled for x64 only so need to load up the project in VS2017 and recompile for x86 to match Excel (my guess anyhow). Haven't tried yet but yeah always crashes 32bit Excel

mattslezak-shell commented 2 years ago

Actually just recompile the whole project in Visual Studio 2017 (you have to git reset --hard 10ba0b6e81ed53d4c97de67fac60ec3f853cfca7 to get the proper 2017 project). If you're using VS 2019 just recompile as is. You will probably need to retarget for the SDK installed on your PC (under Project, Retarget Solution, pick a Windows SDK on the dropdown (it should list those on your PC already) . Seems both the x64 and x86 plug-ins work on my 32 bit Excel, not sure why, but they do. Some functions don't appear to work, but many of them do (I just compiled the project without changing anything except the x1Comp Property Pages / C/C++ / Language: C++ Language Standard: ISO C++7 Standard) and it works. I was using the x1Test.xlsx after adding the plug-in in the Excel Options menu.

arthurpham commented 2 years ago

I had the excel crash as well with Release / 32 bits. Upon investigation, it seems that what solves my problem is to change the "Enable Enchanced Instruction Set" (in the project settings under C/C++ -> Code Generation) from Advanced Vector Extensions 512 (/arch:AVX512) to Advanced Vector Extensions 2 (/arch:AVX2)