Skip to content
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

Add support for VisualStudio and Cuda #22

Closed
josephjaspers opened this issue Jul 23, 2019 · 24 comments
Closed

Add support for VisualStudio and Cuda #22

josephjaspers opened this issue Jul 23, 2019 · 24 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@josephjaspers
Copy link
Owner

No description provided.

@josephjaspers josephjaspers changed the title Add support for VisualStudio and Cuda Add support for VisualStudio and Cuda label:"help wanted" Jul 23, 2019
@josephjaspers josephjaspers changed the title Add support for VisualStudio and Cuda label:"help wanted" Add support for VisualStudio and Cuda Jul 23, 2019
@josephjaspers josephjaspers added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jul 23, 2019
@xinsuinizhuan
Copy link

It is a good new for me to support VS compile. But when i test use my enrironment VisualStudio 2015 64, still some errors.
1、when is compile it, tip array<1,int>={0}, is error,like below:
1563929916(1)
2、then i remove the {0} and {1},,some more errors it appera:
1563931274(1)
3、then i pack my project ,and send to you, please check if it is set error!
BlackCat_Tensors-master.zip

@xinsuinizhuan
Copy link

I send you my VS2015 project, i can compile normally? vs2019 can open vs2015 project, you only open /source/BlackCat_Tensors.sln,then compile it, whether it can compile normally?

@josephjaspers
Copy link
Owner Author

I've just downloaded VS2015. I will see what changes need to be made.

@josephjaspers
Copy link
Owner Author

Hi, VS2015 does not support some of the features required to compile this code.

Constexpr expressions are used quite frequently and supporting VS15 would require changing most of the code.

The code does compile on VS2019 Community edition.

@xinsuinizhuan
Copy link

Thank you! I have downloaded vs2019 to compile my project. But when i run MNIST_TEST example, it crashed at line 44 in host.h, as follow:
1564622033(1)
1564622607(1)

@josephjaspers
Copy link
Owner Author

Thank you for reporting that bug!
Seems I was only testing under 'release' mode.

The code works as expected in Release mode though I will try to fix that bug.

@josephjaspers
Copy link
Owner Author

josephjaspers commented Aug 1, 2019

Hi, I simply replaced "BC::memory::atomic_shared_ptr" with 'std::shared_ptr'
(the atomic feature is not commonly needed anyway).

Should work in debug mode, though I recommend compiling in release mode as it is very slow in debug mode.

Fixed with:
0d7fa5c

Side note:
I also updated the example so now it requires a command-line argument for the path to the mnist_train.csv
a78fa46

@xinsuinizhuan
Copy link

I run the newest code in debug and release, but also crashed!
1564709345(1)
vs2019, windows10,cuda10.1 cudnn7.4

@xinsuinizhuan
Copy link

I debug this problem, it break at openblas, i did don't know why?
1564713445(1)

@josephjaspers
Copy link
Owner Author

OpenBLAS does not always work with other programs that use open mp.
You can try to use...

#define BC_NO_OPENMP

before including "BlackCat_Tensors.h"

@josephjaspers
Copy link
Owner Author

josephjaspers commented Aug 2, 2019

Alternatively according to https://github.com/xianyi/OpenBLAS/wiki/faq

"If the application is parallelized by OpenMP, please build OpenBLAS with USE_OPENMP=1"

@xinsuinizhuan
Copy link

OpenBLAS does not always work with other programs that use open mp.
You can try to use...

#define BC_NO_OPENMP

before including "BlackCat_Tensors.h"

I try:
#define BC_NO_OPENMP
before including "BlackCat_Tensors.h"
but still crashed! Let me try compile OpenMP with USE_OPENMP=1.
Or what your OpenMp version is? Could you send me your OpenMP include and .lib, let me have a try?

@xinsuinizhuan
Copy link

I compile the OpenMP with USE_OPENMP=1, then i run vs2019 project, it still crashed. Then i set the vs2019 project with USE_OpenMP,compile, some errors, below:
1564741893(1)

@xinsuinizhuan
Copy link

Could you sent me you Openblas file (include lib) in windows to me, let me have a try??

@josephjaspers
Copy link
Owner Author

I will see what I can do.
I currently test Windows10 with MKL so you could try that instead of openblas.
I will try to see if I can get openblas to work.

@xinsuinizhuan
Copy link

what is MKL? how to work with MKL? I set project MNIST_Test project OpenMP is true, then some errors is appear, line 218 in BlackCat_Common.h file. below:
1564973112(1)

@xinsuinizhuan
Copy link

The crashed is still, when I seted openblas OpenMP is true, And Set #define BC_NO_OPENMP
before including "BlackCat_Tensors.h"! Others i compelie the mnist_test_recurrent hava some errors.

@josephjaspers
Copy link
Owner Author

Intel MKL
https://software.intel.com/en-us/mkl/features/linear-algebra

If you define BC_NO_OPENMP than all open-mp features should be disabled.
Therefor the issue would be with openblas and not BlackCat_Tensors.

In line 194 in BlackCat_Common.h you can see the features being disabled.

@xinsuinizhuan
Copy link

Yes, I konw! But when i set openmp is true, compiles it appear some errors, it should not appear!

@xinsuinizhuan
Copy link

I install w_mkl_2019.4.245.exe,then what should i do ? which xx.lib file is additional dependencies?

@xinsuinizhuan
Copy link

I test the openblas Independently,it work normally! I create a new project, I cmake the OpenBlas,then include the "lapack-netlib\CBLAS\include" in my project and link the "lib\RELEASE\openblas.lib" and "lib\DEBUG\openblas.lib" to my new project, then i run the below code, it work normally:

int test()
{
float a[1] = { 2 };
float b[1] = { 3 };
float c[1] = { 0 };
cblas_sgemm(CblasRowMajor,
CblasNoTrans, CblasNoTrans,
1, 1, 1,
1,
a, 1,
b, 1,
0,
c, 1);
std::cout << *c << std::endl;

system("pause");
return 0;

}

@xinsuinizhuan
Copy link

But your project when i run the cblas_dgemm, it crashs, line 182 in host.h.
E@U%XT9F)8}1C ERV4LYW
H`M(V~@D@R 7}Q_54I}}XBS

This is my openblas include file and .lib file (cmake openblas, the get them, vs2019, windows10), you can hava a try, to find where is wrong?
openblas.zip

@josephjaspers
Copy link
Owner Author

I will look into it.

@xinsuinizhuan
Copy link

I use the OpenMathLib/OpenBLAS#805 openblas036-win64.zip it works normally. So the problem is the openlabs, then you can focus on the net crnn and lstm! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants