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

Error compiling: cannot bind non-const lvalue reference of type 'std::vector<VAL4<double> >&' to an rvalue of type 'std::vector<VAL4<double> >' #1

Closed
MathieuMoalic opened this issue Aug 21, 2023 · 1 comment

Comments

@MathieuMoalic
Copy link

I compile with the following commands using podman:

podman build -t boris . 
podman run -it --rm --gpus all -v .:/src boris
FROM nvidia/cuda:12.0.1-devel-ubuntu20.04

RUN apt update && \
    DEBIAN_FRONTEND=noninteractive apt-get -qq install \
    wget \
    build-essential \
    libomp-dev \
    libtbb-dev \
    libx11-dev \
    python3.9-dev 

RUN wget https://www.fftw.org/fftw-3.3.10.tar.gz && \
    tar -xf fftw-3.3.10.tar.gz && \
    cd fftw-3.3.10 && \
    ./configure && \
    make && \
    make install

WORKDIR /src

CMD make configure arch=80 sprec=1 python=3.9 cuda=12.0 && \
    make compile -j 30 && \
    make install
g++ -I/usr/local/cuda-12.0/targets/x86_64-linux/include/ -c -Ofast -std=c++17 -I/usr/include/python3.9/ -IBorisLib -IBorisCUDALib -fopenmp Boris/Mesh_Ferromagnetic_MonteCarlo.cpp -o Boris/Boris_o/Mesh_Ferromagnetic_MonteCarlo.o
In file included from BorisCUDALib/BorisCUDALib.h:56,
                 from Boris/Atom_AnisotropyTensorialCUDA.h:8,
                 from Boris/Atom_AnisotropyTensorialCUDA.cpp:2:
BorisCUDALib/mcuVEC_mng.h: In instantiation of 'bool mcuVEC<VType, MType>::copy_from_vector(std::vector<Type>&) [with SType = VAL4<double>; VType = cuVAL4<float>; MType = cuVEC<cuVAL4<float> >]':
Boris/Atom_AnisotropyTensorialCUDA.cpp:29:78:   required from here
BorisCUDALib/mcuVEC_mng.h:555:11: error: cannot bind non-const lvalue reference of type 'std::vector<VAL4<double> >&' to an rvalue of type 'std::vector<VAL4<double> >'
  555 |   success &= mng(mGPU)->copy_from_vector(subvec(vec, s.i, s.j, s.k, e.i, e.j, e.k, n.i, n.j, n.k));
In file included from BorisCUDALib/BorisCUDALib.h:30,
                 from Boris/Atom_AnisotropyTensorialCUDA.h:8,
                 from Boris/Atom_AnisotropyTensorialCUDA.cpp:2:
BorisCUDALib/cuVEC_mng.h:596:66: note:   initializing argument 1 of 'bool cuVEC<VType>::copy_from_vector(std::vector<Type>&) [with SType = VAL4<double>; VType = cuVAL4<float>]'
  596 | __host__ bool cuVEC<VType>::copy_from_vector(std::vector<SType>& vec)
      |                                              ~~~~~~~~~~~~~~~~~~~~^~~
make: *** [makefile:78: Boris/Boris_o/Atom_AnisotropyTensorialCUDA.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [makefile:85: docker-install] Error 2

I'm not sure how to fix this error, my c++ knowledge is close to null.

@SerbanL
Copy link
Owner

SerbanL commented Aug 22, 2023

Pushed update now which fixed this.

@SerbanL SerbanL closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants