facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.63k stars 6.42k forks source link

RuntimeError: Error compiling objects for extension when install lightconv with setup.py provideded in examples #4277

Open Namco0816 opened 2 years ago

Namco0816 commented 2 years ago

In the examples of lightweight and dynamic convolutions, to install the light/dynamic convolutions I ran the scripts:

python cuda_function_gen.py
python setup.py install

However I got the error "RuntimeError: Error compiling objects for extension"

some part of the error are as follows:

home/namco/fairseq/fairseq/modules/lightconv_layer/../cuda_utils.cu(99): error: namespace "std" has no member "cout"

/home/namco/fairseq/fairseq/modules/lightconv_layer/../cuda_utils.cu(100): error: namespace "std" has no member "endl"

/home/namco/fairseq/fairseq/modules/lightconv_layer/../cuda_utils.cu(101): error: namespace "std" has no member "cout"

/home/namco/fairseq/fairseq/modules/lightconv_layer/../cuda_utils.cu(101): error: namespace "std" has no member "endl"

/home/namco/fairseq/fairseq/modules/lightconv_layer/../cuda_utils.cu(49): error: identifier "SHFL_MASK" is undefined
          detected during:
            instantiation of "scalar_t blockReduce(scalar_t) [with scalar_t=float]" 
/home/namco/fairseq/fairseq/modules/lightconv_layer/lightconv_cuda_kernel.cu(238): here
            instantiation of "void lightconv_grad_wrt_weights_firstpass_short_kernel<FS,SB,padding_l,scalar_t>(const scalar_t *, const scalar_t *, int, int, int, int, int, float *) [with FS=3, SB=32, padding_l=1, scalar_t=double]" 
/home/namco/fairseq/fairseq/modules/lightconv_layer/lightconv_cuda_backward.cu(44): here

5 errors detected in the compilation of "/home/namco/fairseq/fairseq/modules/lightconv_layer/lightconv_cuda_kernel.cu".

Environment

pixas commented 2 years ago

Because you use a high version pytorch. You could change two places.

After these modifications, I successfully build the kernel. I hope my successful experience can help you as well.

Environment

Namco0816 commented 2 years ago

Thanks for your help! it works. Thank you!