diff --git a/applications/plugins/SofaCUDA/CMakeLists.txt b/applications/plugins/SofaCUDA/CMakeLists.txt index b29d34f653f..062e84c175a 100644 --- a/applications/plugins/SofaCUDA/CMakeLists.txt +++ b/applications/plugins/SofaCUDA/CMakeLists.txt @@ -5,390 +5,37 @@ set(SOFACUDA_MAJOR_VERSION 0) set(SOFACUDA_MINOR_VERSION 1) set(SOFACUDA_VERSION ${SOFACUDA_MAJOR_VERSION}.${SOFACUDA_MINOR_VERSION}) -if(DEFINED CUDA_ARCH_LIST) - message(WARNING "CUDA_ARCH_LIST variable is deprecated ; use cmake built-in variable CMAKE_CUDA_ARCHITECTURES instead (see https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html)") - string(REPLACE "." "" CUDA_ARCH_LIST_REFORMATED "${CUDA_ARCH_LIST}") - message(WARNING "${CUDA_ARCH_LIST_REFORMATED} will be set in CMAKE_CUDA_ARCHITECTURES.") - set(CMAKE_CUDA_ARCHITECTURES ${CUDA_ARCH_LIST_REFORMATED}) -endif() +find_package(Sofa.Config REQUIRED) -if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") - option(SOFACUDA_ENABLE_NATIVE_ARCHITECTURE "Set native as for CUDA_ARCHITECTURES (which will compile compatible architectures for the current system)") - if(SOFACUDA_ENABLE_NATIVE_ARCHITECTURE) - set(CMAKE_CUDA_ARCHITECTURES native) - endif() -endif() +set(SOFACUDA_SOURCE_DIR "src/SofaCUDA") -# set 75 as fallback value -if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) - message(NOTICE "CMAKE_CUDA_ARCHITECTURES is not set, it will be set by default to 75") - set(CMAKE_CUDA_ARCHITECTURES 75) -endif() - -set(SOFACUDACORE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") -set(SOFACUDA_SOURCE_DIR "${SOFACUDACORE_SOURCE_DIR}/SofaCUDA") +sofa_add_subdirectory_modules(SOFACUDA_TARGETS + DIRECTORIES + Core + Component +) set(HEADER_FILES ${SOFACUDA_SOURCE_DIR}/config.h.in ${SOFACUDA_SOURCE_DIR}/init.h - - ### Common - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaBaseVector.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaCommon.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaContactMapper.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMath.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMath.inl - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMathRigid.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMathRigid.inl - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMatrix.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMemoryManager.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaScan.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSort.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaTypes.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/mycuda.h - - ### Mechanical - ${SOFACUDA_SOURCE_DIR}/component/statecontainer/CudaMechanicalObject.h - ${SOFACUDA_SOURCE_DIR}/component/statecontainer/CudaMechanicalObject.inl - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSingleStateAccessor.h - - ### Mappings - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping.h - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping.inl - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMappingRigid.h - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBeamLinearMapping.h - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaIdentityMapping.h - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaIdentityMapping.inl - ${SOFACUDA_SOURCE_DIR}/component/mapping/nonlinear/CudaRigidMapping.h - ${SOFACUDA_SOURCE_DIR}/component/mapping/nonlinear/CudaRigidMapping.inl - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaSubsetMapping.h - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaSubsetMapping.inl - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaSubsetMultiMapping.h - - - ### Mass - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaDiagonalMass.h - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaDiagonalMass.inl - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaMeshMatrixMass.h - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaMeshMatrixMass.inl - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaUniformMass.h - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaUniformMass.inl - - - ### FEM - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaHexahedronTLEDForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.inl - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.inl - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.inl - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.inl - - ### ForceFields - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaConstantForceField.h - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaEllipsoidForceField.h - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaEllipsoidForceField.inl - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaLinearForceField.h - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaLinearForceField.inl - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaPlaneForceField.h - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaPlaneForceField.inl - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaSphereForceField.h - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaSphereForceField.inl - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/spring/CudaSpringForceField.h - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/spring/CudaSpringForceField.inl - - ### Collisions - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaLineModel.h - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaPointModel.h - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaSphereModel.h - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaTriangleModel.h - - ### Constraints - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaFixedProjectiveConstraint.h - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaFixedProjectiveConstraint.inl - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaLinearMovementProjectiveConstraint.h - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaLinearMovementProjectiveConstraint.inl - ${SOFACUDA_SOURCE_DIR}/component/collision/response/contact/CudaPenalityContactForceField.h - ${SOFACUDA_SOURCE_DIR}/component/collision/response/contact/CudaPenalityContactForceField.inl - ) set(SOURCE_FILES - ### Common ${SOFACUDA_SOURCE_DIR}/init.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaBaseVector.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaContactMapper.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/mycuda.cpp - - ### Mechanical - ${SOFACUDA_SOURCE_DIR}/component/statecontainer/CudaMechanicalObject.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSetTopology.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSingleStateAccessor.cpp - - ### Mappings - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping-3f.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping-3f1-f.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping-3f1.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping-f.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMappingRigid.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaIdentityMapping.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMultiMapping.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/nonlinear/CudaRigidMapping.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaSubsetMapping.cpp - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaSubsetMultiMapping.cpp - - ### Mass - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaDiagonalMass.cpp - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaMeshMatrixMass.cpp - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaUniformMass.cpp - - ### FEM - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp - - ### ForceFields - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaConstantForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaEllipsoidForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaLinearForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/collision/response/contact/CudaPenalityContactForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaPlaneForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaSphereForceField.cpp - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/spring/CudaSpringForceField.cpp - - - ### Collisions - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaCollision.cpp - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaLineModel.cpp - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaPointModel.cpp - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaSphereModel.cpp - ${SOFACUDA_SOURCE_DIR}/component/collision/geometry/CudaTriangleModel.cpp - - ### Constraints - ${SOFACUDA_SOURCE_DIR}/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaFixedProjectiveConstraint.cpp - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp - - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBeamLinearMapping.cpp - ${SOFACUDA_SOURCE_DIR}/component/engine/select/CudaBoxROI.cpp - ${SOFACUDA_SOURCE_DIR}/component/engine/select/CudaNearestPointROI.cpp - ${SOFACUDA_SOURCE_DIR}/component/engine/select/CudaSphereROI.cpp - - ${SOFACUDA_SOURCE_DIR}/component/engine/transform/CudaIndexValueMapper.cpp - - ### ConstraintCorrection - ${SOFACUDA_SOURCE_DIR}/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp - ${SOFACUDA_SOURCE_DIR}/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp - ${SOFACUDA_SOURCE_DIR}/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp ) -set(CUDA_SOURCES - ### Common - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/mycuda.cu - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaBaseVector.cu - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaContactMapper.cu - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaScan.cu - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSort.cu - - ### Mechanical - ${SOFACUDA_SOURCE_DIR}/component/statecontainer/CudaMechanicalObject.cu - - ### Mappings - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaBarycentricMapping.cu - ${SOFACUDA_SOURCE_DIR}/component/mapping/nonlinear/CudaRigidMapping.cu - ${SOFACUDA_SOURCE_DIR}/component/mapping/linear/CudaSubsetMapping.cu - - ### Mass - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaDiagonalMass.cu - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaMeshMatrixMass.cu - ${SOFACUDA_SOURCE_DIR}/component/mass/CudaUniformMass.cu - - ### FEM - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cu - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cu - - ### ForceFields - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaEllipsoidForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaLinearForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/collision/response/contact/CudaPenalityContactForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaPlaneForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/mechanicalload/CudaSphereForceField.cu - ${SOFACUDA_SOURCE_DIR}/component/solidmechanics/spring/CudaSpringForceField.cu - - ### Collisions - - ### Constraints - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaFixedProjectiveConstraint.cu - ${SOFACUDA_SOURCE_DIR}/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cu - - -) +set(TARGET_NAME ${PROJECT_NAME}) -sofa_find_package(Sofa.GL QUIET) -if(NOT Sofa.GL_FOUND) - message(WARNING "Sofa.GL is not active.") - message("OpenGL-related code won't be enabled (Sharing OpenGL buffers with CUDA)") -else() - list(APPEND HEADER_FILES - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaVisualModel.h - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaVisualModel.inl - ) - list(APPEND SOURCE_FILES - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaVisualModel.cpp - ) - list(APPEND CUDA_SOURCES - ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/cuda/CudaVisualModel.cu - ) -endif() +add_library(${TARGET_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) +target_link_libraries(${TARGET_NAME} PUBLIC Sofa.Config) +target_link_libraries(${TARGET_NAME} PUBLIC ${SOFACUDA_TARGETS}) -set(README_FILES README.md) - -sofa_find_package(Sofa.Component.Mass REQUIRED) -sofa_find_package(Sofa.Component.SolidMechanics.FEM.Elastic REQUIRED) -sofa_find_package(Sofa.Component.SolidMechanics.FEM.HyperElastic REQUIRED) -sofa_find_package(Sofa.Component.SolidMechanics.TensorMass REQUIRED) -sofa_find_package(Sofa.Component.Collision.Response.Contact REQUIRED) -sofa_find_package(Sofa.Component.Collision.Detection.Algorithm REQUIRED) -sofa_find_package(Sofa.Component.Collision.Detection.Intersection REQUIRED) -sofa_find_package(Sofa.Component.StateContainer REQUIRED) -sofa_find_package(Sofa.Component.Constraint.Projective REQUIRED) -sofa_find_package(Sofa.Component.Mapping.Linear REQUIRED) -sofa_find_package(Sofa.Component.Mapping.NonLinear REQUIRED) -sofa_find_package(Sofa.Component.Engine.Select REQUIRED) -sofa_find_package(Sofa.Component.Engine.Transform REQUIRED) -sofa_find_package(Sofa.Component.MechanicalLoad REQUIRED) - -sofa_find_package(Sofa.GUI QUIET) -if(Sofa.GUI_FOUND) - list(APPEND SOURCE_FILES ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/gui/CudaMouseInteraction.cpp) -endif() - -sofa_find_package(Sofa.Qt QUIET) -if(Sofa.Qt_FOUND) - list(APPEND HEADER_FILES ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/gui/CudaDataWidget.h) - list(APPEND SOURCE_FILES ${SOFACUDACORE_SOURCE_DIR}/sofa/gpu/gui/CudaDataWidget.cpp) -endif() - -option(SOFACUDA_VERBOSE_PTXAS "???" OFF) - -option(SOFACUDA_CUBLAS "Activate cublas support in CUDA (requires SOFACUDA_DOUBLE)." OFF) -if(SOFACUDA_CUBLAS) - set(SOFA_GPU_CUBLAS 1) # #cmakedefine - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) - find_package(CUDASparse REQUIRED) -endif() - -# Note: THRUST is included in CUDA SDK 4.0+, it is recommended to use it if available -option(SOFACUDA_THRUST "Activate THRUST (for RadixSort)." ON) -if(SOFACUDA_THRUST) - set(SOFA_GPU_THRUST 1) # #cmakedefine -endif() - -option(SOFACUDA_DOUBLE "Activate double-precision support in CUDA (requires GT200+ GPU and -arch sm_13 flag." OFF) -if(SOFACUDA_DOUBLE) - set(SOFA_GPU_CUDA_DOUBLE 1) # #cmakedefine -endif() - - -# Note: with SOFA_GPU_CUDA_PRECISE and SOFA_GPU_CUDA_DOUBLE you get IEEE -# 754-compliant floating point operations for addition and multiplication only. -option(SOFACUDA_PRECISE "Use IEEE 754-compliant floating point operations." OFF) -option(SOFACUDA_DOUBLE_PRECISE "Enable double-precision for sqrt/div..." OFF) -if(SOFACUDA_PRECISE) - set(SOFA_GPU_CUDA_PRECISE 1) # #cmakedefine -endif() -if(SOFACUDA_DOUBLE_PRECISE) - set(SOFA_GPU_CUDA_DOUBLE_PRECISE 1) # #cmakedefine -endif() - - -sofa_find_package(CUDAToolkit 11.0 REQUIRED) - -# nvcc uses a "host code compiler" to compile CPU code, specified by CUDA_HOST_COMPILER. -# With some versions of CMake, CUDA_HOST_COMPILER defaults to CMAKE_C_COMPILER, -# but few host compilers are actually supported. Workarounds should go here. -if (${CUDA_HOST_COMPILER} MATCHES "ccache$") - message(STATUS "SofaCUDA: CUDA host compiler was set to ccache, changing to g++") - set(CUDA_HOST_COMPILER "g++" CACHE STRING "Host side compiler used by NVCC" FORCE) -endif() - -add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES} ${README_FILES}) -set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${SOFACUDA_COMPILE_DEFINITIONS}") -if(SOFACUDA_VERBOSE_PTXAS) - target_compile_options(${PROJECT_NAME} PRIVATE $<$:--ptxas-options=-v>) -endif() -if(MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Xcompiler /Zc:__cplusplus>) -endif() -if(WIN32) - target_compile_options(${PROJECT_NAME} PRIVATE $<$:-DWIN32>) -endif() - -target_link_libraries(${PROJECT_NAME} - Sofa.Component.Mass - Sofa.Component.SolidMechanics.FEM.Elastic - Sofa.Component.SolidMechanics.FEM.HyperElastic - Sofa.Component.SolidMechanics.TensorMass - Sofa.Component.MechanicalLoad - Sofa.Component.Collision.Response.Contact - Sofa.Component.Collision.Detection.Algorithm - Sofa.Component.Collision.Detection.Intersection - Sofa.Component.StateContainer - Sofa.Component.Constraint.Projective - Sofa.Component.Mapping.Linear - Sofa.Component.Mapping.NonLinear - Sofa.Component.Engine.Select - Sofa.Component.Engine.Transform - Sofa.Component.MechanicalLoad -) - -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17 cuda_std_17) -target_link_libraries(${PROJECT_NAME} CUDA::cudart) - -if(Sofa.GL_FOUND) - target_link_libraries(${PROJECT_NAME} Sofa.GL) -endif() - -if(Sofa.GUI_FOUND) - target_link_libraries(${PROJECT_NAME} Sofa.GUI) -endif() - - -if(Sofa.Qt_FOUND) - target_link_libraries(${PROJECT_NAME} Sofa.Qt) -endif() - -if(SOFACUDA_CUBLAS) - target_link_libraries(${PROJECT_NAME} ${CUDA_cusparse_LIBRARY} CUDA::cublas) - -endif() - -## Install rules for the library and headers; CMake package configurations files sofa_create_package_with_targets( PACKAGE_NAME ${PROJECT_NAME} PACKAGE_VERSION ${SOFACUDA_VERSION} TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES - INCLUDE_INSTALL_DIR "${PROJECT_NAME}" INCLUDE_SOURCE_DIR "src" - RELOCATABLE "plugins" + INCLUDE_INSTALL_DIR "${PROJECT_NAME}" ) + +add_subdirectory(extensions) diff --git a/applications/plugins/SofaCUDA/Component/CMakeLists.txt b/applications/plugins/SofaCUDA/Component/CMakeLists.txt new file mode 100644 index 00000000000..227c5370dda --- /dev/null +++ b/applications/plugins/SofaCUDA/Component/CMakeLists.txt @@ -0,0 +1,262 @@ +cmake_minimum_required(VERSION 3.22) +project(SofaCUDA.Component LANGUAGES CUDA CXX) + +set(SOFACUDA_COMPONENT_MAJOR_VERSION 0) +set(SOFACUDA_COMPONENT_MINOR_VERSION 1) +set(SOFACUDA_COMPONENT_VERSION ${SOFACUDA_COMPONENT_MAJOR_VERSION}.${SOFACUDA_COMPONENT_MINOR_VERSION}) + +set(SOFACUDA_COMPONENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") + +set(HEADER_FILES + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/config.h.in + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/init.h + + ### Mechanical + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/statecontainer/CudaMechanicalObject.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/statecontainer/CudaMechanicalObject.inl + + ### Mappings + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaIdentityMapping.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaSubsetMapping.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h + + + ### Mass + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaDiagonalMass.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaDiagonalMass.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaMeshMatrixMass.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaMeshMatrixMass.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.inl + + + ### solidmechanics + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.h + + ### MechanicalLoad + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaConstantForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaLinearForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaLinearForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaPlaneForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaPlaneForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaSphereForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaSphereForceField.inl + + ### Collisions + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaLineModel.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaPointModel.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaSphereModel.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaTriangleModel.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/mapper/CudaContactMapper.h + + ### Constraints + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.inl + + ### Visual + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/visual/CudaVisualModel.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/visual/CudaVisualModel.inl +) + +set(SOURCE_FILES + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/init.cpp + + ### Mechanical + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp + + ### Mappings + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-f.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-f.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp + + ### Mass + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaDiagonalMass.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cpp + + ### Solidmechanics + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cpp + + ### MechanicalLoad + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp + + + ### Collisions + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaLineModel.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaPointModel.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaSphereModel.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/detection/intersection/CudaProximityIntersection.cpp + + ### Constraints + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp + + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/engine/select/CudaBoxROI.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/engine/select/CudaSphereROI.cpp + + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp + + ### ConstraintCorrection + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp + + ### Topology + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/topology/container/dynamic/CudaSetTopology.cpp + + ### Visual + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/visual/CudaVisualModel.cpp + +) + +set(CUDA_SOURCES + + ### Mechanical + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/statecontainer/CudaMechanicalObject.cu + + ### Mappings + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cu + + ### Mass + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaDiagonalMass.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaMeshMatrixMass.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cu + + ### solidmechanics + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cu + + ### mechanicalload + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaLinearForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mechanicalload/CudaSphereForceField.cu + + ### Collisions + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cu + + ### Constraints + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cu + + ### Visual + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/visual/CudaVisualModel.cu + + +) + +find_package(Sofa.Config REQUIRED) +sofa_find_package(SofaCUDA.Core REQUIRED) +sofa_find_package(Sofa.Component.Mass REQUIRED) +sofa_find_package(Sofa.Component.SolidMechanics.FEM.Elastic REQUIRED) +sofa_find_package(Sofa.Component.SolidMechanics.FEM.HyperElastic REQUIRED) +sofa_find_package(Sofa.Component.SolidMechanics.TensorMass REQUIRED) +sofa_find_package(Sofa.Component.Collision.Response.Contact REQUIRED) +sofa_find_package(Sofa.Component.Collision.Detection.Algorithm REQUIRED) +sofa_find_package(Sofa.Component.Collision.Detection.Intersection REQUIRED) +sofa_find_package(Sofa.Component.StateContainer REQUIRED) +sofa_find_package(Sofa.Component.Constraint.Projective REQUIRED) +sofa_find_package(Sofa.Component.Mapping.Linear REQUIRED) +sofa_find_package(Sofa.Component.Mapping.NonLinear REQUIRED) +sofa_find_package(Sofa.Component.Engine.Select REQUIRED) +sofa_find_package(Sofa.Component.Engine.Transform REQUIRED) +sofa_find_package(Sofa.Component.MechanicalLoad REQUIRED) + +add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES}) + +target_link_libraries(${PROJECT_NAME} PUBLIC SofaCUDA.Core) +target_link_libraries(${PROJECT_NAME} PUBLIC + Sofa.Component.Mass + Sofa.Component.SolidMechanics.FEM.Elastic + Sofa.Component.SolidMechanics.FEM.HyperElastic + Sofa.Component.SolidMechanics.TensorMass + Sofa.Component.MechanicalLoad + Sofa.Component.Collision.Response.Contact + Sofa.Component.Collision.Detection.Algorithm + Sofa.Component.Collision.Detection.Intersection + Sofa.Component.StateContainer + Sofa.Component.Constraint.Projective + Sofa.Component.Mapping.Linear + Sofa.Component.Mapping.NonLinear + Sofa.Component.Engine.Select + Sofa.Component.Engine.Transform + Sofa.Component.MechanicalLoad +) + +# see (I guess) https://github.com/sofa-framework/sofa/blob/314b95cbfba411bf8431486ea75b7c67c0bbcc76/Sofa/framework/Config/cmake/SofaMacrosInstall.cmake#L695 +target_include_directories(${PROJECT_NAME} PUBLIC "$/include/${PROJECT_NAME}/${PROJECT_NAME}") + +## Install rules for the library and headers; CMake package configurations files +sofa_create_package_with_targets( + PACKAGE_NAME ${PROJECT_NAME} + PACKAGE_VERSION ${SOFACUDA_COMPONENT_VERSION} + TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES + INCLUDE_INSTALL_DIR "${PROJECT_NAME}" + INCLUDE_SOURCE_DIR "src" + RELOCATABLE "plugins" +) diff --git a/applications/plugins/SofaCUDA/Component/SofaCUDA.ComponentConfig.cmake.in b/applications/plugins/SofaCUDA/Component/SofaCUDA.ComponentConfig.cmake.in new file mode 100644 index 00000000000..3f79c77273e --- /dev/null +++ b/applications/plugins/SofaCUDA/Component/SofaCUDA.ComponentConfig.cmake.in @@ -0,0 +1,29 @@ +# CMake package configuration file for the SofaCUDA.Component plugin + +@PACKAGE_GUARD@ +@PACKAGE_INIT@ + +find_package(Sofa.Config QUIET REQUIRED) + +sofa_find_package(SofaCUDA.Core QUIET REQUIRED) + +sofa_find_package(Sofa.Component.Mass QUIET REQUIRED) +sofa_find_package(Sofa.Component.SolidMechanics.FEM.Elastic QUIET REQUIRED) +sofa_find_package(Sofa.Component.SolidMechanics.FEM.HyperElastic QUIET REQUIRED) +sofa_find_package(Sofa.Component.SolidMechanics.TensorMass QUIET REQUIRED) +sofa_find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED) +sofa_find_package(Sofa.Component.Collision.Detection.Intersection QUIET REQUIRED) +sofa_find_package(Sofa.Component.StateContainer QUIET REQUIRED) +sofa_find_package(Sofa.Component.Constraint.Projective QUIET REQUIRED) +sofa_find_package(Sofa.Component.Mapping.Linear QUIET REQUIRED) +sofa_find_package(Sofa.Component.Mapping.NonLinear QUIET REQUIRED) +sofa_find_package(Sofa.Component.Engine.Select QUIET REQUIRED) +sofa_find_package(Sofa.Component.Engine.Transform QUIET REQUIRED) +sofa_find_package(Sofa.Component.MechanicalLoad QUIET REQUIRED) + +if(NOT TARGET SofaCUDA.Component) + include("${CMAKE_CURRENT_LIST_DIR}/SofaCUDA.ComponentTargets.cmake") +endif() + +check_required_components(SofaCUDA.Component) + diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaCollision.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/detection/intersection/CudaProximityIntersection.cpp similarity index 80% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaCollision.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/detection/intersection/CudaProximityIntersection.cpp index f48f11f3c1b..69ffbca1573 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaCollision.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/detection/intersection/CudaProximityIntersection.cpp @@ -20,11 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include -#include -#include -#include "CudaContactMapper.h" -#include +#include #include #include @@ -33,23 +29,11 @@ #include #include #include -#include -#include #include -#include -#include -#include -#include -#include #include -#include -#include - - - namespace sofa::gpu::cuda { diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaLineModel.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaLineModel.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaLineModel.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaLineModel.cpp index cc37556cf0b..e1537f42be7 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaLineModel.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaLineModel.cpp @@ -20,6 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #define SOFA_GPU_CUDA_CUDALINEMODEL_CPP +#include #include #include @@ -27,12 +28,12 @@ namespace sofa::component::collision::geometry { -template class SOFA_GPU_CUDA_API LineCollisionModel; -template class SOFA_GPU_CUDA_API LineCollisionModel; +template class SOFACUDA_COMPONENT_API LineCollisionModel; +template class SOFACUDA_COMPONENT_API LineCollisionModel; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API LineCollisionModel; -template class SOFA_GPU_CUDA_API LineCollisionModel; +template class SOFACUDA_COMPONENT_API LineCollisionModel; +template class SOFACUDA_COMPONENT_API LineCollisionModel; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::collision::geometry diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaLineModel.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaLineModel.h similarity index 85% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaLineModel.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaLineModel.h index 915072a61f6..18ad94daea8 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaLineModel.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaLineModel.h @@ -38,11 +38,11 @@ using CudaLine = sofa::component::collision::geometry::TLine; namespace sofa::component::collision::geometry { #if !defined(SOFA_GPU_CUDA_CUDALINEMODEL_CPP) -extern template class SOFA_GPU_CUDA_API LineCollisionModel; -extern template class SOFA_GPU_CUDA_API LineCollisionModel; +extern template class SOFACUDA_COMPONENT_API LineCollisionModel; +extern template class SOFACUDA_COMPONENT_API LineCollisionModel; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API LineCollisionModel; -extern template class SOFA_GPU_CUDA_API LineCollisionModel; +extern template class SOFACUDA_COMPONENT_API LineCollisionModel; +extern template class SOFACUDA_COMPONENT_API LineCollisionModel; #endif // SOFA_GPU_CUDA_DOUBLE #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaPointModel.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaPointModel.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaPointModel.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaPointModel.cpp diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaPointModel.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaPointModel.h similarity index 94% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaPointModel.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaPointModel.h index f59bf88d72a..5694402231a 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaPointModel.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaPointModel.h @@ -21,6 +21,8 @@ ******************************************************************************/ #pragma once +#include + #include #include #include @@ -36,7 +38,7 @@ using namespace sofa::defaulttype; class CudaPointCollisionModel; -class SOFA_GPU_CUDA_API CudaPoint : public core::TCollisionElementIterator +class SOFACUDA_COMPONENT_API CudaPoint : public core::TCollisionElementIterator { public: CudaPoint(CudaPointCollisionModel* model, Index index); @@ -47,7 +49,7 @@ class SOFA_GPU_CUDA_API CudaPoint : public core::TCollisionElementIterator #include #include @@ -28,11 +29,11 @@ namespace sofa::component::collision::geometry { -template class SOFA_GPU_CUDA_API SphereCollisionModel; -template class SOFA_GPU_CUDA_API SphereCollisionModel; +template class SOFACUDA_COMPONENT_API SphereCollisionModel; +template class SOFACUDA_COMPONENT_API SphereCollisionModel; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API SphereCollisionModel; -template class SOFA_GPU_CUDA_API SphereCollisionModel; +template class SOFACUDA_COMPONENT_API SphereCollisionModel; +template class SOFACUDA_COMPONENT_API SphereCollisionModel; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::collision::geometry diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaSphereModel.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaSphereModel.h similarity index 84% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaSphereModel.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaSphereModel.h index 1e8c47aaf2e..ca6a2aebc97 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaSphereModel.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaSphereModel.h @@ -20,6 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once +#include #include #include @@ -39,11 +40,11 @@ namespace sofa::component::collision::geometry { #if !defined(SOFA_GPU_CUDA_CUDASPHEREMODEL_CPP) -extern template class SOFA_GPU_CUDA_API SphereCollisionModel; -extern template class SOFA_GPU_CUDA_API SphereCollisionModel; +extern template class SOFACUDA_COMPONENT_API SphereCollisionModel; +extern template class SOFACUDA_COMPONENT_API SphereCollisionModel; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API SphereCollisionModel; -extern template class SOFA_GPU_CUDA_API SphereCollisionModel; +extern template class SOFACUDA_COMPONENT_API SphereCollisionModel; +extern template class SOFACUDA_COMPONENT_API SphereCollisionModel; #endif // SOFA_GPU_CUDA_DOUBLE #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp similarity index 86% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp index 1457fc1c353..a756fb02b57 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.cpp @@ -20,6 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #define SOFA_GPU_CUDA_CUDATRIANGLEMODEL_CPP +#include #include #include @@ -28,11 +29,11 @@ namespace sofa::component::collision::geometry { -template class SOFA_GPU_CUDA_API TriangleCollisionModel; -template class SOFA_GPU_CUDA_API TriangleCollisionModel; +template class SOFACUDA_COMPONENT_API TriangleCollisionModel; +template class SOFACUDA_COMPONENT_API TriangleCollisionModel; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TriangleCollisionModel; -template class SOFA_GPU_CUDA_API TriangleCollisionModel; +template class SOFACUDA_COMPONENT_API TriangleCollisionModel; +template class SOFACUDA_COMPONENT_API TriangleCollisionModel; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::collision::geometry diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.h similarity index 85% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.h index bf7bedccf70..6b0d81d8589 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/geometry/CudaTriangleModel.h @@ -37,11 +37,11 @@ using CudaTriangle = sofa::component::collision::geometry::TTriangle; -extern template class SOFA_GPU_CUDA_API TriangleCollisionModel; +extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel; +extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API TriangleCollisionModel; -extern template class SOFA_GPU_CUDA_API TriangleCollisionModel; +extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel; +extern template class SOFACUDA_COMPONENT_API TriangleCollisionModel; #endif // SOFA_GPU_CUDA_DOUBLE #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp index 9137ab7c570..897329d4b2a 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -26,12 +28,12 @@ namespace sofa::component::collision::response::contact { using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3f1Types>; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3dTypes>; -template class SOFA_GPU_CUDA_API PenalityContactForceField< CudaVec3d1Types>; +template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API PenalityContactForceField< CudaVec3d1Types>; #endif } // sofa::component::collision::response::contact diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/contact/CudaPenalityContactForceField.inl diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cpp similarity index 84% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cpp index 2cb69480783..18b8e850e24 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cpp @@ -21,12 +21,12 @@ ******************************************************************************/ #define SOFACUDA_CUDACONTACTMAPPER_CPP -#include +#include namespace sofa::component::collision { -template class SOFA_GPU_CUDA_API response::mapper::ContactMapper; -template class SOFA_GPU_CUDA_API response::mapper::ContactMapper; +template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper; +template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper; } diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.cu diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.h similarity index 94% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.h index 33196df2843..05a44256dd6 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaContactMapper.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/collision/response/mapper/CudaContactMapper.h @@ -115,8 +115,8 @@ class response::mapper::ContactMapper : pub }; #if !defined(SOFACUDA_CUDACONTACTMAPPER_CPP) -extern template class SOFA_GPU_CUDA_API response::mapper::ContactMapper; -extern template class SOFA_GPU_CUDA_API response::mapper::ContactMapper; +extern template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper; +extern template class SOFACUDA_COMPONENT_API response::mapper::ContactMapper; #endif } // namespace sofa::component::collision diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/config.h.in b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/config.h.in new file mode 100644 index 00000000000..c8c46cbc60d --- /dev/null +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/config.h.in @@ -0,0 +1,36 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include + +#ifdef SOFA_BUILD_SOFACUDA_COMPONENT +# define SOFACUDA_COMPONENT_API SOFA_EXPORT_DYNAMIC_LIBRARY +#else +# define SOFACUDA_COMPONENT_API SOFA_IMPORT_DYNAMIC_LIBRARY +#endif + +namespace sofacuda::component +{ + constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; + constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; +} // namespace sofacuda::component diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp index 8e54aba59aa..8c9b8c0e414 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaLinearSolverConstraintCorrection.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -28,12 +30,12 @@ namespace sofa::component::constraint::lagrangian::correction { using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3f1Types >; +template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3fTypes >; +template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3f1Types >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3dTypes >; -template class SOFA_GPU_CUDA_API LinearSolverConstraintCorrection< CudaVec3d1Types >; +template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3dTypes >; +template class SOFACUDA_COMPONENT_API LinearSolverConstraintCorrection< CudaVec3d1Types >; #endif } // namespace sofa::component::constraint::lagrangian::correction diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp index 8620e098097..41949ce3a08 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaPrecomputedConstraintCorrection.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -28,12 +30,12 @@ namespace sofa::component::constraint::lagrangian::correction { using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3f1Types >; +template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3fTypes >; +template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3f1Types >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3dTypes >; -template class SOFA_GPU_CUDA_API PrecomputedConstraintCorrection< CudaVec3d1Types >; +template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3dTypes >; +template class SOFACUDA_COMPONENT_API PrecomputedConstraintCorrection< CudaVec3d1Types >; #endif } // namespace sofa::component::constraint::lagrangian::correction diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp index 1c5cfcd41d8..03df6faa5f1 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/correction/CudaUncoupledConstraintCorrection.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -29,12 +31,12 @@ namespace sofa::component::constraint::lagrangian::correction { using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API UncoupledConstraintCorrection< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API UncoupledConstraintCorrection< CudaVec3f1Types >; +template class SOFACUDA_COMPONENT_API UncoupledConstraintCorrection< CudaVec3fTypes >; +template class SOFACUDA_COMPONENT_API UncoupledConstraintCorrection< CudaVec3f1Types >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API UncoupledConstraintCorrection< CudaVec3dTypes >; -template class SOFA_GPU_CUDA_API UncoupledConstraintCorrection< CudaVec3d1Types >; +template class SOFACUDA_COMPONENT_API UncoupledConstraintCorrection< CudaVec3dTypes >; +template class SOFACUDA_COMPONENT_API UncoupledConstraintCorrection< CudaVec3d1Types >; #endif } // namespace sofa::component::constraint::lagrangian::correction diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp similarity index 86% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp index b0a6c92f609..b090bdfeeea 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/lagrangian/model/CudaBilateralLagrangianConstraint.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -27,12 +29,12 @@ namespace sofa::component::constraint::lagrangian::model { -template class SOFA_GPU_CUDA_API BilateralLagrangianConstraint; -template class SOFA_GPU_CUDA_API BilateralLagrangianConstraint; +template class SOFACUDA_COMPONENT_API BilateralLagrangianConstraint; +template class SOFACUDA_COMPONENT_API BilateralLagrangianConstraint; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API BilateralLagrangianConstraint; -template class SOFA_GPU_CUDA_API BilateralLagrangianConstraint; +template class SOFACUDA_COMPONENT_API BilateralLagrangianConstraint; +template class SOFACUDA_COMPONENT_API BilateralLagrangianConstraint; #endif // SOFA_GPU_CUDA_DOUBLE } //namespace sofa::component::constraint::lagrangian::model diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp similarity index 79% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp index fe7cc813bdc..82719fb019e 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -29,17 +31,17 @@ namespace sofa::component::constraint::projective { -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedProjectiveConstraint; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::constraint::projective diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedProjectiveConstraint.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp similarity index 92% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp index 311db979b03..4717e16495e 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaFixedTranslationProjectiveConstraint.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -100,11 +102,11 @@ void component::constraint::projective::FixedTranslationProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedTranslationProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedTranslationProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedTranslationProjectiveConstraint; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API FixedTranslationProjectiveConstraint; -template class SOFA_GPU_CUDA_API FixedTranslationProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedTranslationProjectiveConstraint; +template class SOFACUDA_COMPONENT_API FixedTranslationProjectiveConstraint; #endif // SOFA_GPU_CUDA_DOUBLE }// namespace sofa::component::constraint::projective diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp index d095261ab5b..2fa19f847eb 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -28,12 +30,12 @@ namespace sofa::core::behavior { - template class SOFA_GPU_CUDA_API ProjectiveConstraintSet; - template class SOFA_GPU_CUDA_API ProjectiveConstraintSet; + template class SOFACUDA_COMPONENT_API ProjectiveConstraintSet; + template class SOFACUDA_COMPONENT_API ProjectiveConstraintSet; #ifdef SOFA_GPU_CUDA_DOUBLE - template class SOFA_GPU_CUDA_API ProjectiveConstraintSet; - template class SOFA_GPU_CUDA_API ProjectiveConstraintSet; + template class SOFACUDA_COMPONENT_API ProjectiveConstraintSet; + template class SOFACUDA_COMPONENT_API ProjectiveConstraintSet; #endif } // namespace sofa::core::behavior diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearMovementProjectiveConstraint.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp similarity index 86% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp index 6b05fe46a9f..27ba7aa6a95 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/constraint/projective/CudaLinearVelocityProjectiveConstraint.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include @@ -28,11 +30,11 @@ namespace sofa::component::constraint::projective { -template class SOFA_GPU_CUDA_API LinearVelocityProjectiveConstraint; -template class SOFA_GPU_CUDA_API LinearVelocityProjectiveConstraint; +template class SOFACUDA_COMPONENT_API LinearVelocityProjectiveConstraint; +template class SOFACUDA_COMPONENT_API LinearVelocityProjectiveConstraint; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API LinearVelocityProjectiveConstraint; -template class SOFA_GPU_CUDA_API LinearVelocityProjectiveConstraint; +template class SOFACUDA_COMPONENT_API LinearVelocityProjectiveConstraint; +template class SOFACUDA_COMPONENT_API LinearVelocityProjectiveConstraint; #endif // SOFA_GPU_CUDA_DOUBLE }// namespace sofa::component::constraint::projective diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaBoxROI.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaBoxROI.cpp similarity index 82% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaBoxROI.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaBoxROI.cpp index 3982fa02abc..9f1379db0e8 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaBoxROI.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaBoxROI.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -27,14 +29,14 @@ namespace sofa::component::engine::select { -template class SOFA_GPU_CUDA_API boxroi::BoxROI; -template class SOFA_GPU_CUDA_API boxroi::BoxROI; -template class SOFA_GPU_CUDA_API boxroi::BoxROI; -template class SOFA_GPU_CUDA_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API boxroi::BoxROI; -template class SOFA_GPU_CUDA_API boxroi::BoxROI; -template class SOFA_GPU_CUDA_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; +template class SOFACUDA_COMPONENT_API boxroi::BoxROI; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::engine::select diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp index 3cd10b1e6d5..94629b513c1 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaNearestPointROI.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -26,11 +28,11 @@ namespace sofa::component::engine::select { -template class SOFA_GPU_CUDA_API NearestPointROI; -template class SOFA_GPU_CUDA_API NearestPointROI; +template class SOFACUDA_COMPONENT_API NearestPointROI; +template class SOFACUDA_COMPONENT_API NearestPointROI; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API NearestPointROI; -template class SOFA_GPU_CUDA_API NearestPointROI; +template class SOFACUDA_COMPONENT_API NearestPointROI; +template class SOFACUDA_COMPONENT_API NearestPointROI; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::engine::data diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaSphereROI.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaSphereROI.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaSphereROI.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaSphereROI.cpp index bfb20d8b5d3..119e96fdf8d 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/select/CudaSphereROI.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/select/CudaSphereROI.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -28,11 +30,11 @@ namespace sofa::component::engine::select { -template class SOFA_GPU_CUDA_API SphereROI; -template class SOFA_GPU_CUDA_API SphereROI; +template class SOFACUDA_COMPONENT_API SphereROI; +template class SOFACUDA_COMPONENT_API SphereROI; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API SphereROI; -template class SOFA_GPU_CUDA_API SphereROI; +template class SOFACUDA_COMPONENT_API SphereROI; +template class SOFACUDA_COMPONENT_API SphereROI; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::engine::select diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp index c5e96ae4fa0..b97121217c0 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/engine/transform/CudaIndexValueMapper.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -28,11 +30,11 @@ namespace sofa::component::engine::transform { -template class SOFA_GPU_CUDA_API IndexValueMapper; -template class SOFA_GPU_CUDA_API IndexValueMapper; +template class SOFACUDA_COMPONENT_API IndexValueMapper; +template class SOFACUDA_COMPONENT_API IndexValueMapper; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API IndexValueMapper; -template class SOFA_GPU_CUDA_API IndexValueMapper; +template class SOFACUDA_COMPONENT_API IndexValueMapper; +template class SOFACUDA_COMPONENT_API IndexValueMapper; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::engine::transform diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp new file mode 100644 index 00000000000..f9c124998fb --- /dev/null +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp @@ -0,0 +1,248 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include + +#include +#include +#include +#include + +namespace sofa::gpu::cuda +{ + +// component::collision::geometry +extern void registerLineCollisionModel(sofa::core::ObjectFactory* factory); +extern void registerPointCollisionModel(sofa::core::ObjectFactory* factory); +extern void registerSphereCollisionModel(sofa::core::ObjectFactory* factory); +extern void registerTriangleCollisionModel(sofa::core::ObjectFactory* factory); + +// component::collision::response::contact +extern void registerPenalityContactForceField(sofa::core::ObjectFactory* factory); + +// component::constraint::lagrangian::correction +extern void registerLinearSolverConstraintCorrection(sofa::core::ObjectFactory* factory); +extern void registerPrecomputedConstraintCorrection(sofa::core::ObjectFactory* factory); +extern void registerUncoupledConstraintCorrection(sofa::core::ObjectFactory* factory); + +// component::constraint::lagrangian::model +extern void registerBilateralLagrangianConstraint(sofa::core::ObjectFactory* factory); + +// component::constraint::projective +extern void registerFixedProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerFixedTranslationProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerLinearMovementProjectiveConstraint(sofa::core::ObjectFactory* factory); +extern void registerLinearVelocityProjectiveConstraint(sofa::core::ObjectFactory* factory); + +// component::engine::select +extern void registerBoxROI(sofa::core::ObjectFactory* factory); +extern void registerNearestPointROI(sofa::core::ObjectFactory* factory); +extern void registerSphereROI(sofa::core::ObjectFactory* factory); + +// component::engine::transform +extern void registerIndexValueMapper(sofa::core::ObjectFactory* factory); + +// component::mapping::linear +extern void registerBarycentricMapping(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_f(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_3fRigid(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_3f(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_3f1(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_3f1_f(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_3f1_3f(sofa::core::ObjectFactory* factory); +extern void registerBarycentricMapping_3f1_d(sofa::core::ObjectFactory* factory); +extern void registerBeamLinearMapping(sofa::core::ObjectFactory* factory); +extern void registerIdentityMapping(sofa::core::ObjectFactory* factory); +extern void registerSubsetMapping(sofa::core::ObjectFactory* factory); +extern void registerSubsetMultiMapping(sofa::core::ObjectFactory* factory); + +// component::mapping::nonlinear +extern void registerRigidMapping(sofa::core::ObjectFactory* factory); + +// component::mass +extern void registerDiagonalMass(sofa::core::ObjectFactory* factory); +extern void registerMeshMatrixMass(sofa::core::ObjectFactory* factory); +extern void registerUniformMass(sofa::core::ObjectFactory* factory); + +// component::mechanicalload +extern void registerConstantForceField(sofa::core::ObjectFactory* factory); +extern void registerEllipsoidForceField(sofa::core::ObjectFactory* factory); +extern void registerLinearForceField(sofa::core::ObjectFactory* factory); +extern void registerPlaneForceField(sofa::core::ObjectFactory* factory); +extern void registerSphereForceField(sofa::core::ObjectFactory* factory); + +// component::solidmechanics::fem::elastic +extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory); + +// component::solidmechanics::fem::hyperelastic +extern void registerStandardTetrahedralFEMForceField(sofa::core::ObjectFactory* factory); + +// component::solidmechanics::spring +extern void registerMeshSpringForceField(sofa::core::ObjectFactory* factory); +extern void registerQuadBendingSprings(sofa::core::ObjectFactory* factory); +extern void registerRestShapeSpringsForceField(sofa::core::ObjectFactory* factory); +extern void registerSpringForceField(sofa::core::ObjectFactory* factory); +extern void registerTriangleBendingSprings(sofa::core::ObjectFactory* factory); + +// component::solidmechanics::tensormass +extern void registerTetrahedralTensorMassForceField(sofa::core::ObjectFactory* factory); + +// component::statecontainer +extern void registerMechanicalObject(sofa::core::ObjectFactory* factory); + +// component::visualmodel +extern void registerVisualModel(sofa::core::ObjectFactory* factory); + +// component::collision::detection::intersection +extern void registerProximityIntersection(sofa::core::ObjectFactory* factory); + +// component::topology::container::dynamic +extern void registerPointSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerEdgeSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerTriangleSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerQuadSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerTetrahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerHexahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); + +// component::solidmechanics::tled +extern void registerTetrahedronTLEDForceField(sofa::core::ObjectFactory* factory); +extern void registerHexahedronTLEDForceField(sofa::core::ObjectFactory* factory); + +} // namespace sofa::gpu::cuda + +namespace sofacuda::component +{ + +//Here are just several convenient functions to help user to know what contains the plugin +extern "C" { + SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleLicense(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleDescription(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); +} + +void init() +{ + static bool first = true; + if (first) + { + sofacuda::core::init(); + + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } +} + +void initExternalModule() +{ + init(); +} + +const char* getModuleName() +{ + return MODULE_NAME; +} + +const char* getModuleVersion() +{ + return MODULE_VERSION; +} + +const char* getModuleLicense() +{ + return "LGPL"; +} + +const char* getModuleDescription() +{ + return "A subset of SOFA componend using NVIDIA CUDA"; +} + +void registerObjects(sofa::core::ObjectFactory* factory) +{ + using namespace sofa::gpu::cuda; + + registerLineCollisionModel(factory); + registerPointCollisionModel(factory); + registerSphereCollisionModel(factory); + registerTriangleCollisionModel(factory); + registerPenalityContactForceField(factory); + registerLinearSolverConstraintCorrection(factory); + registerPrecomputedConstraintCorrection(factory); + registerUncoupledConstraintCorrection(factory); + registerBilateralLagrangianConstraint(factory); + registerFixedProjectiveConstraint(factory); + registerFixedTranslationProjectiveConstraint(factory); + registerLinearMovementProjectiveConstraint(factory); + registerLinearVelocityProjectiveConstraint(factory); + registerBoxROI(factory); + registerNearestPointROI(factory); + registerSphereROI(factory); + registerIndexValueMapper(factory); + registerBarycentricMapping(factory); + registerBarycentricMapping_f(factory); + registerBarycentricMapping_3fRigid(factory); + registerBarycentricMapping_3f(factory); + registerBarycentricMapping_3f1(factory); + registerBarycentricMapping_3f1_f(factory); + registerBarycentricMapping_3f1_3f(factory); + registerBarycentricMapping_3f1_d(factory); + registerBeamLinearMapping(factory); + registerIdentityMapping(factory); + registerSubsetMapping(factory); + registerSubsetMultiMapping(factory); + registerRigidMapping(factory); + registerDiagonalMass(factory); + registerMeshMatrixMass(factory); + registerUniformMass(factory); + registerConstantForceField(factory); + registerEllipsoidForceField(factory); + registerLinearForceField(factory); + registerPlaneForceField(factory); + registerSphereForceField(factory); + registerHexahedronFEMForceField(factory); + registerTetrahedronFEMForceField(factory); + registerTriangularFEMForceFieldOptim(factory); + registerStandardTetrahedralFEMForceField(factory); + registerMeshSpringForceField(factory); + registerQuadBendingSprings(factory); + registerRestShapeSpringsForceField(factory); + registerSpringForceField(factory); + registerTriangleBendingSprings(factory); + registerTetrahedralTensorMassForceField(factory); + registerMechanicalObject(factory); + registerVisualModel(factory); + registerProximityIntersection(factory); + registerPointSetGeometryAlgorithms(factory); + registerEdgeSetGeometryAlgorithms(factory); + registerTriangleSetGeometryAlgorithms(factory); + registerQuadSetGeometryAlgorithms(factory); + registerTetrahedronSetGeometryAlgorithms(factory); + registerHexahedronSetGeometryAlgorithms(factory); +} + +} // namespace sofacuda::component diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.h new file mode 100644 index 00000000000..fd3e0603b31 --- /dev/null +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include + +namespace sofacuda::component +{ + SOFACUDA_COMPONENT_API void init(); +} // namespace sofacuda::component diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp similarity index 98% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp index 323a001acb3..91b86be1714 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -253,7 +255,7 @@ void BarycentricMapperMeshTopology::resize( core: // Spread the instantiations over multiple files for more efficient and lightweight compilation // Instantiations involving only CudaVec3fTypes -template class SOFA_GPU_CUDA_API BarycentricMapping< CudaVec3fTypes, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3fTypes, CudaVec3fTypes>; } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp similarity index 98% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp index 477a18373e2..49b3bb65fe9 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-3f.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -412,8 +414,8 @@ void BarycentricMapperMeshTopology::resize( core // instantiations involving CudaVec3f1Types with CudaVec3fTypes -template class SOFA_GPU_CUDA_API BarycentricMapping< CudaVec3f1Types, CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API BarycentricMapping< CudaVec3fTypes, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3f1Types, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3fTypes, CudaVec3f1Types>; diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp similarity index 92% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp index e6bce8a910b..f7b2ae29f0a 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-d.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -38,8 +40,8 @@ using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API BarycentricMapping< Vec3Types, CudaVec3f1Types>; -template class SOFA_GPU_CUDA_API BarycentricMapping< CudaVec3f1Types, Vec3Types>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< Vec3Types, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3f1Types, Vec3Types>; } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-f.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-f.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-f.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1-f.cpp diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp similarity index 98% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp index 65bdf8d7a14..f7dfb8ff9e1 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-3f1.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -229,7 +231,7 @@ void BarycentricMapperMeshTopology::resize( cor // instantiations involving only CudaVec3f1Types with CudaVec3f1Types -template class SOFA_GPU_CUDA_API BarycentricMapping< CudaVec3f1Types, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3f1Types, CudaVec3f1Types>; diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-f.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-f.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-f.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping-f.cpp diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp similarity index 93% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp index d29a7906e91..73a3eee5ccf 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -36,8 +38,8 @@ using namespace sofa::gpu::cuda; // Spread the instantiations over multiple files for more efficient and lightweight compilation. See CudaBarycentricMapping-*.cpp files. // Instantiations involving both CudaVec3fTypes and Vec3dTypes -template class SOFA_GPU_CUDA_API BarycentricMapping< Vec3Types, CudaVec3Types>; -template class SOFA_GPU_CUDA_API BarycentricMapping< CudaVec3Types, Vec3Types>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< Vec3Types, CudaVec3Types>; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3Types, Vec3Types>; } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMapping.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp similarity index 98% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp index c8c3ce2d39d..74cdece92d1 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.cpp @@ -20,6 +20,8 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #define SOFA_COMPONENT_MAPPING_CUDABARYCENTRICMAPPINGRIGID_CPP +#include + #include #include @@ -183,7 +185,7 @@ void BarycentricMapperHexahedronSetTopology; +template class SOFACUDA_COMPONENT_API BarycentricMapping< CudaVec3Types, Rigid3Types >; } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBarycentricMappingRigid.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp similarity index 93% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp index bce68d92908..19042acc1ac 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.cpp @@ -55,11 +55,11 @@ using namespace defaulttype; using namespace core; using namespace core::behavior; -template class SOFA_GPU_CUDA_API BeamLinearMapping< Rigid3Types, sofa::gpu::cuda::CudaVec3Types>; +template class SOFACUDA_COMPONENT_API BeamLinearMapping< Rigid3Types, sofa::gpu::cuda::CudaVec3Types>; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API BeamLinearMapping< Rigid3Types, sofa::gpu::cuda::CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API BeamLinearMapping< Rigid3Types, sofa::gpu::cuda::CudaVec3dTypes>; #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h index db3c1b9d4cc..384ce7681b0 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaBeamLinearMapping.h @@ -21,7 +21,7 @@ ******************************************************************************/ #pragma once -#include +#include #include #if !defined(SOFA_COMPONENT_MAPPING_CUDABEAMLINEARMAPPING_CPP) @@ -32,10 +32,10 @@ namespace sofa::component::mapping::linear { -extern template class SOFA_GPU_CUDA_API BeamLinearMapping< defaulttype::Rigid3Types, sofa::gpu::cuda::CudaVec3Types>; +extern template class SOFACUDA_COMPONENT_API BeamLinearMapping< defaulttype::Rigid3Types, sofa::gpu::cuda::CudaVec3Types>; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API BeamLinearMapping< defaulttype::Rigid3Types, sofa::gpu::cuda::CudaVec3dTypes>; +extern template class SOFACUDA_COMPONENT_API BeamLinearMapping< defaulttype::Rigid3Types, sofa::gpu::cuda::CudaVec3dTypes>; #endif } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp similarity index 76% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp index 3f6e971f906..04e8404cf73 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.cpp @@ -20,6 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #define SOFA_GPU_CUDA_CUDAIDENTITYMAPPING_CPP +#include #include #include @@ -33,26 +34,26 @@ using namespace sofa::defaulttype; using namespace sofa::gpu::cuda; // CudaVec3fTypes -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, CudaVec3f1Types>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, Vec3Types>; -template class SOFA_GPU_CUDA_API IdentityMapping< Vec3Types, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, Vec3Types>; +template class SOFACUDA_COMPONENT_API IdentityMapping< Vec3Types, CudaVec3fTypes>; // CudaVec3f1Types -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3f1Types, CudaVec3f1Types>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3f1Types, CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3f1Types, Vec3Types>; -template class SOFA_GPU_CUDA_API IdentityMapping< Vec3dTypes, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3f1Types, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3f1Types, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3f1Types, Vec3Types>; +template class SOFACUDA_COMPONENT_API IdentityMapping< Vec3dTypes, CudaVec3f1Types>; #ifdef SOFA_GPU_CUDA_DOUBLE // CudaVec3dTypes -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3dTypes, CudaVec3dTypes>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3dTypes, CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3dTypes, Vec3Types>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3dTypes, CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3dTypes, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3dTypes, Vec3Types>; -template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, CudaVec3dTypes>; -template class SOFA_GPU_CUDA_API IdentityMapping< Vec3Types, CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API IdentityMapping< Vec3Types, CudaVec3dTypes>; #endif } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h similarity index 74% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h index 0a2987c45a6..0cf89ee8ebd 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.h @@ -62,26 +62,26 @@ using namespace sofa::component::mapping::linear; using namespace sofa::gpu::cuda; // CudaVec3fTypes -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, CudaVec3fTypes>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, CudaVec3f1Types>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, Vec3Types>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< Vec3Types, CudaVec3fTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, CudaVec3fTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, CudaVec3f1Types>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, Vec3Types>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< Vec3Types, CudaVec3fTypes>; // CudaVec3f1Types -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3f1Types, CudaVec3f1Types>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3f1Types, CudaVec3fTypes>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3f1Types, Vec3Types>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< Vec3dTypes, CudaVec3f1Types>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3f1Types, CudaVec3f1Types>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3f1Types, CudaVec3fTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3f1Types, Vec3Types>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< Vec3dTypes, CudaVec3f1Types>; #ifdef SOFA_GPU_CUDA_DOUBLE // CudaVec3dTypes -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3dTypes, CudaVec3dTypes>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3dTypes, CudaVec3fTypes>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3dTypes, Vec3Types>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3dTypes, CudaVec3dTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3dTypes, CudaVec3fTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3dTypes, Vec3Types>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< CudaVec3fTypes, CudaVec3dTypes>; -extern template class SOFA_GPU_CUDA_API IdentityMapping< Vec3Types, CudaVec3dTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< CudaVec3fTypes, CudaVec3dTypes>; +extern template class SOFACUDA_COMPONENT_API IdentityMapping< Vec3Types, CudaVec3dTypes>; #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaIdentityMapping.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp index 25fb05e9200..53994f1c566 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cpp @@ -21,6 +21,7 @@ ******************************************************************************/ #ifndef SOFA_GPU_CUDA_CUDASUBSETMAPPING_CPP #define SOFA_GPU_CUDA_CUDASUBSETMAPPING_CPP +#include #include #include @@ -30,10 +31,10 @@ namespace sofa::component::mapping::linear { using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API SubsetMapping< CudaVec3fTypes, CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API SubsetMapping< CudaVec3f1Types, CudaVec3f1Types >; -template class SOFA_GPU_CUDA_API SubsetMapping< CudaVec3f1Types, CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API SubsetMapping< CudaVec3fTypes, CudaVec3f1Types >; +template class SOFACUDA_COMPONENT_API SubsetMapping< CudaVec3fTypes, CudaVec3fTypes >; +template class SOFACUDA_COMPONENT_API SubsetMapping< CudaVec3f1Types, CudaVec3f1Types >; +template class SOFACUDA_COMPONENT_API SubsetMapping< CudaVec3f1Types, CudaVec3fTypes >; +template class SOFACUDA_COMPONENT_API SubsetMapping< CudaVec3fTypes, CudaVec3f1Types >; } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h similarity index 92% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h index 3c17ecbc25a..683948d7c96 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.h @@ -146,10 +146,10 @@ void SubsetMapping::apply #ifndef SOFA_GPU_CUDA_CUDASUBSETMAPPING_CPP -extern template class SOFA_GPU_CUDA_API SubsetMapping< sofa::gpu::cuda::CudaVec3fTypes, sofa::gpu::cuda::CudaVec3fTypes >; -extern template class SOFA_GPU_CUDA_API SubsetMapping< sofa::gpu::cuda::CudaVec3f1Types, sofa::gpu::cuda::CudaVec3f1Types >; -extern template class SOFA_GPU_CUDA_API SubsetMapping< sofa::gpu::cuda::CudaVec3f1Types, sofa::gpu::cuda::CudaVec3fTypes >; -extern template class SOFA_GPU_CUDA_API SubsetMapping< sofa::gpu::cuda::CudaVec3fTypes, sofa::gpu::cuda::CudaVec3f1Types >; +extern template class SOFACUDA_COMPONENT_API SubsetMapping< sofa::gpu::cuda::CudaVec3fTypes, sofa::gpu::cuda::CudaVec3fTypes >; +extern template class SOFACUDA_COMPONENT_API SubsetMapping< sofa::gpu::cuda::CudaVec3f1Types, sofa::gpu::cuda::CudaVec3f1Types >; +extern template class SOFACUDA_COMPONENT_API SubsetMapping< sofa::gpu::cuda::CudaVec3f1Types, sofa::gpu::cuda::CudaVec3fTypes >; +extern template class SOFACUDA_COMPONENT_API SubsetMapping< sofa::gpu::cuda::CudaVec3fTypes, sofa::gpu::cuda::CudaVec3f1Types >; #endif } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMapping.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp similarity index 80% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp index facba7ddce2..358999532b3 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.cpp @@ -52,16 +52,16 @@ namespace sofa::component::mapping::linear { using namespace sofa::gpu::cuda; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec3Types, CudaVec3Types >; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec1Types, CudaVec1Types >; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3Types, CudaRigid3Types >; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3Types, CudaVec3Types >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec3Types, CudaVec3Types >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec1Types, CudaVec1Types >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3Types, CudaRigid3Types >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3Types, CudaVec3Types >; #ifdef SOFA_GPU_CUDA_DOUBLE - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec3dTypes, CudaVec3dTypes >; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec1dTypes, CudaVec1dTypes >; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3dTypes, CudaRigid3dTypes >; - template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3dTypes, CudaVec3dTypes >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec3dTypes, CudaVec3dTypes >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec1dTypes, CudaVec1dTypes >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3dTypes, CudaRigid3dTypes >; + template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3dTypes, CudaVec3dTypes >; #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h similarity index 70% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h index c09bd19fb0a..1773e4b92d6 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/linear/CudaSubsetMultiMapping.h @@ -21,7 +21,7 @@ ******************************************************************************/ #pragma once -#include +#include #include #if !defined(SOFA_COMPONENT_MAPPING_CUDASUBSETMULTIMAPPING_CPP) @@ -33,16 +33,16 @@ namespace sofa::component::mapping::linear using namespace sofa::gpu::cuda; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec3Types, CudaVec3Types >; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec1Types, CudaVec1Types >; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3Types, CudaRigid3Types >; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3Types, CudaVec3Types >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec3Types, CudaVec3Types >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec1Types, CudaVec1Types >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3Types, CudaRigid3Types >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3Types, CudaVec3Types >; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec3dTypes, CudaVec3dTypes >; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaVec1dTypes, CudaVec1dTypes >; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3dTypes, CudaRigid3dTypes >; -extern template class SOFA_GPU_CUDA_API SubsetMultiMapping< CudaRigid3dTypes, CudaVec3dTypes >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec3dTypes, CudaVec3dTypes >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaVec1dTypes, CudaVec1dTypes >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3dTypes, CudaRigid3dTypes >; +extern template class SOFACUDA_COMPONENT_API SubsetMultiMapping< CudaRigid3dTypes, CudaVec3dTypes >; #endif } // namespace sofa::component::mapping::linear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp similarity index 71% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp index d0342b4c048..a27b86d0c46 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -34,26 +36,26 @@ using namespace sofa::core; using namespace sofa::core::behavior; using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3fTypes, CudaVec3fTypes>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3Types, CudaVec3Types>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3Types, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3fTypes, CudaVec3fTypes>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3Types, CudaVec3Types>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3Types, CudaVec3f1Types>; -//template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, Vec3dTypes>; -//template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, Vec3fTypes>; -template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, CudaVec3f1Types>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3fTypes, CudaVec3f1Types>; +//template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, Vec3dTypes>; +//template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, Vec3fTypes>; +template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, CudaVec3f1Types>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3fTypes, CudaVec3f1Types>; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, CudaVec3dTypes>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3fTypes, CudaVec3dTypes>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3dTypes, CudaVec3dTypes>; -//template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, Vec3dTypes>; -//template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, Vec3fTypes>; -template class SOFA_GPU_CUDA_API RigidMapping< CudaRigid3fTypes, CudaVec3d1Types>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3fTypes, CudaVec3d1Types>; -template class SOFA_GPU_CUDA_API RigidMapping< Rigid3dTypes, CudaVec3d1Types>; +template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3fTypes, CudaVec3dTypes>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3dTypes, CudaVec3dTypes>; +//template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, Vec3dTypes>; +//template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, Vec3fTypes>; +template class SOFACUDA_COMPONENT_API RigidMapping< CudaRigid3fTypes, CudaVec3d1Types>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3fTypes, CudaVec3d1Types>; +template class SOFACUDA_COMPONENT_API RigidMapping< Rigid3dTypes, CudaVec3d1Types>; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::mapping::nonlinear diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mapping/nonlinear/CudaRigidMapping.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.cpp similarity index 93% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.cpp index 201f1bd61d3..6b9ce569f90 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.cpp @@ -22,6 +22,8 @@ #ifndef SOFA_GPU_CUDA_CUDADIAGONALMASS_CPP #define SOFA_GPU_CUDA_CUDADIAGONALMASS_CPP +#include + #include #include #include @@ -40,10 +42,10 @@ namespace sofa namespace component::mass { -template class SOFA_GPU_CUDA_API DiagonalMass; +template class SOFACUDA_COMPONENT_API DiagonalMass; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API DiagonalMass; +template class SOFACUDA_COMPONENT_API DiagonalMass; #endif } // namespace component::mass diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.h similarity index 95% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.h index 215c8ccce9c..7b3e2dbec93 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.h @@ -80,9 +80,9 @@ void DiagonalMass::addForce(const core::MechanicalPar #endif // SOFA_GPU_CUDA_DOUBLE #ifndef SOFA_GPU_CUDA_CUDADIAGONALMASS_CPP -extern template class SOFA_GPU_CUDA_API component::mass::DiagonalMass; +extern template class SOFACUDA_COMPONENT_API component::mass::DiagonalMass; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API component::mass::DiagonalMass; +extern template class SOFACUDA_COMPONENT_API component::mass::DiagonalMass; #endif #endif diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaDiagonalMass.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaDiagonalMass.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp similarity index 75% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp index 74f9c961ac2..81d505f88f2 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cpp @@ -21,6 +21,7 @@ ******************************************************************************/ #ifndef SOFA_GPU_CUDA_CUDAMESHMATRIXMASS_CPP #define SOFA_GPU_CUDA_CUDAMESHMATRIXMASS_CPP +#include #include #include @@ -44,20 +45,20 @@ namespace sofa namespace component::mass { -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; -template class SOFA_GPU_CUDA_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; +template class SOFACUDA_COMPONENT_API MeshMatrixMass; #endif // SOFA_GPU_CUDA_DOUBLE diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.h similarity index 77% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.h index 029a2ad8b9d..d328b0b025e 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.h @@ -100,20 +100,20 @@ void MeshMatrixMass::accFromF(const core::Mecha #ifndef SOFA_GPU_CUDA_CUDAMESHMATRIXMASS_CPP -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; -extern template class SOFA_GPU_CUDA_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; +extern template class SOFACUDA_COMPONENT_API MeshMatrixMass; #endif // SOFA_GPU_CUDA_DOUBLE #endif //SOFA_GPU_CUDA_CUDAMESHMATRIXMASS_CPP diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaMeshMatrixMass.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaMeshMatrixMass.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.cpp diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mass/CudaUniformMass.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mass/CudaUniformMass.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp similarity index 77% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp index ea86e048542..e7447f6778b 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.cpp @@ -58,30 +58,30 @@ namespace sofa::component::mechanicalload { using namespace sofa::gpu::cuda; - template <> SOFA_GPU_CUDA_API + template <> SOFACUDA_COMPONENT_API SReal ConstantForceField::getPotentialEnergy(const core::MechanicalParams*, const DataVecCoord& ) const { return 0; } - template <> SOFA_GPU_CUDA_API + template <> SOFACUDA_COMPONENT_API SReal ConstantForceField::getPotentialEnergy(const core::MechanicalParams*, const DataVecCoord& ) const { return 0; } - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; #ifdef SOFA_GPU_CUDA_DOUBLE - template <> SOFA_GPU_CUDA_API + template <> SOFACUDA_COMPONENT_API SReal ConstantForceField::getPotentialEnergy(const core::MechanicalParams*, const DataVecCoord& ) const { return 0; } - template <> SOFA_GPU_CUDA_API + template <> SOFACUDA_COMPONENT_API SReal ConstantForceField::getPotentialEnergy(const core::MechanicalParams*, const DataVecCoord& ) const { return 0; } - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; - template class SOFA_GPU_CUDA_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; + template class SOFACUDA_COMPONENT_API ConstantForceField; #endif } // namespace sofa::component::mechanicalload diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.h similarity index 66% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.h index c2d9df5d30c..a2936462e4d 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaConstantForceField.h @@ -21,7 +21,7 @@ ******************************************************************************/ #pragma once -#include +#include #include #if !defined(SOFA_COMPONENT_FORCEFIELD_CUDACONSTANTFORCEFIELD_CPP) @@ -33,20 +33,20 @@ namespace sofa::component::mechanicalload using namespace sofa::gpu::cuda; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; -extern template class SOFA_GPU_CUDA_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; +extern template class SOFACUDA_COMPONENT_API ConstantForceField; #endif } // namespace sofa::component::mechanicalload diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cpp diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaEllipsoidForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp similarity index 85% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp index 29a0d12699f..8574200256c 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include @@ -28,12 +30,12 @@ namespace sofa::component::mechanicalload { -template class SOFA_GPU_CUDA_API LinearForceField; -template class SOFA_GPU_CUDA_API LinearForceField; -template class SOFA_GPU_CUDA_API LinearForceField; +template class SOFACUDA_COMPONENT_API LinearForceField; +template class SOFACUDA_COMPONENT_API LinearForceField; +template class SOFACUDA_COMPONENT_API LinearForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API LinearForceField; -template class SOFA_GPU_CUDA_API LinearForceField; +template class SOFACUDA_COMPONENT_API LinearForceField; +template class SOFACUDA_COMPONENT_API LinearForceField; #endif // SOFA_GPU_CUDA_DOUBLE }// namespace sofa::component::mechanicalload diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaLinearForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cpp diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaPlaneForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp index 06d2e731593..6d611659390 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -26,12 +28,12 @@ namespace sofa::component::mechanicalload { -template class SOFA_GPU_CUDA_API SphereForceField< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API SphereForceField< CudaVec3f1Types >; +template class SOFACUDA_COMPONENT_API SphereForceField< CudaVec3fTypes >; +template class SOFACUDA_COMPONENT_API SphereForceField< CudaVec3f1Types >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API SphereForceField< CudaVec3dTypes >; -template class SOFA_GPU_CUDA_API SphereForceField< CudaVec3d1Types >; +template class SOFACUDA_COMPONENT_API SphereForceField< CudaVec3dTypes >; +template class SOFACUDA_COMPONENT_API SphereForceField< CudaVec3d1Types >; #endif } diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/mechanicalload/CudaSphereForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp similarity index 86% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp index cb28ba84be6..9b0f8e7a5ba 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -26,11 +28,11 @@ namespace sofa::component::solidmechanics::fem::elastic { -template class SOFA_GPU_CUDA_API HexahedronFEMForceField; -template class SOFA_GPU_CUDA_API HexahedronFEMForceField; +template class SOFACUDA_COMPONENT_API HexahedronFEMForceField; +template class SOFACUDA_COMPONENT_API HexahedronFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API HexahedronFEMForceField; -template class SOFA_GPU_CUDA_API HexahedronFEMForceField; +template class SOFACUDA_COMPONENT_API HexahedronFEMForceField; +template class SOFACUDA_COMPONENT_API HexahedronFEMForceField; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp index b175091b1a7..16ae1b0ef9b 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -27,11 +29,11 @@ namespace sofa::component::solidmechanics::fem::elastic { using namespace sofa::gpu::cuda; -template class SOFA_GPU_CUDA_API TetrahedronFEMForceField; -template class SOFA_GPU_CUDA_API TetrahedronFEMForceField; +template class SOFACUDA_COMPONENT_API TetrahedronFEMForceField; +template class SOFACUDA_COMPONENT_API TetrahedronFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TetrahedronFEMForceField; -template class SOFA_GPU_CUDA_API TetrahedronFEMForceField; +template class SOFACUDA_COMPONENT_API TetrahedronFEMForceField; +template class SOFACUDA_COMPONENT_API TetrahedronFEMForceField; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTetrahedronFEMForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp similarity index 91% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp index 77f3129c4d1..ee812e61f80 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -26,9 +28,9 @@ namespace sofa::component::solidmechanics::fem::elastic { -template class SOFA_GPU_CUDA_API TriangularFEMForceFieldOptim; +template class SOFACUDA_COMPONENT_API TriangularFEMForceFieldOptim; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TriangularFEMForceFieldOptim; +template class SOFACUDA_COMPONENT_API TriangularFEMForceFieldOptim; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaTriangularFEMForceFieldOptim.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp index c77442f78d4..b9f3de52076 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -45,9 +47,9 @@ namespace gpu::cuda } // namespace gpu::cuda -template class SOFA_GPU_CUDA_API sofa::component::solidmechanics::fem::hyperelastic::StandardTetrahedralFEMForceField; +template class SOFACUDA_COMPONENT_API sofa::component::solidmechanics::fem::hyperelastic::StandardTetrahedralFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API sofa::component::solidmechanics::fem::hyperelastic::StandardTetrahedralFEMForceField; +template class SOFACUDA_COMPONENT_API sofa::component::solidmechanics::fem::hyperelastic::StandardTetrahedralFEMForceField; #endif } // namespace sofa diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp similarity index 87% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp index 70690cbd82b..256e9749008 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaRestShapeSpringsForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -29,11 +31,11 @@ namespace sofa::component::solidmechanics::spring { -template class SOFA_GPU_CUDA_API RestShapeSpringsForceField; -template class SOFA_GPU_CUDA_API RestShapeSpringsForceField; +template class SOFACUDA_COMPONENT_API RestShapeSpringsForceField; +template class SOFACUDA_COMPONENT_API RestShapeSpringsForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API RestShapeSpringsForceField; -template class SOFA_GPU_CUDA_API RestShapeSpringsForceField; +template class SOFACUDA_COMPONENT_API RestShapeSpringsForceField; +template class SOFACUDA_COMPONENT_API RestShapeSpringsForceField; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::solidmechanics::spring diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp similarity index 83% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp index ac1cd762b57..8c6ca5f9c5f 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -28,12 +30,12 @@ namespace sofa::core::behavior { -template class SOFA_GPU_CUDA_API PairInteractionForceField; -template class SOFA_GPU_CUDA_API PairInteractionForceField; +template class SOFACUDA_COMPONENT_API PairInteractionForceField; +template class SOFACUDA_COMPONENT_API PairInteractionForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API PairInteractionForceField; -template class SOFA_GPU_CUDA_API PairInteractionForceField; +template class SOFACUDA_COMPONENT_API PairInteractionForceField; +template class SOFACUDA_COMPONENT_API PairInteractionForceField; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::core::behavior @@ -42,19 +44,19 @@ template class SOFA_GPU_CUDA_API PairInteractionForceField; -template class SOFA_GPU_CUDA_API MeshSpringForceField; +template class SOFACUDA_COMPONENT_API SpringForceField; +template class SOFACUDA_COMPONENT_API MeshSpringForceField; -template class SOFA_GPU_CUDA_API SpringForceField; -template class SOFA_GPU_CUDA_API MeshSpringForceField; +template class SOFACUDA_COMPONENT_API SpringForceField; +template class SOFACUDA_COMPONENT_API MeshSpringForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API SpringForceField; -template class SOFA_GPU_CUDA_API MeshSpringForceField; +template class SOFACUDA_COMPONENT_API SpringForceField; +template class SOFACUDA_COMPONENT_API MeshSpringForceField; -template class SOFA_GPU_CUDA_API SpringForceField; -template class SOFA_GPU_CUDA_API MeshSpringForceField; +template class SOFACUDA_COMPONENT_API SpringForceField; +template class SOFACUDA_COMPONENT_API MeshSpringForceField; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::solidmechanics::spring diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/spring/CudaSpringForceField.inl diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp similarity index 88% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp index 81e0f7acaf8..d1c24ed72b9 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -44,9 +46,9 @@ namespace gpu::cuda } // namespace gpu::cuda -template class SOFA_GPU_CUDA_API sofa::component::solidmechanics::tensormass::TetrahedralTensorMassForceField; +template class SOFACUDA_COMPONENT_API sofa::component::solidmechanics::tensormass::TetrahedralTensorMassForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API sofa::component::solidmechanics::tensormass::TetrahedralTensorMassForceField; +template class SOFACUDA_COMPONENT_API sofa::component::solidmechanics::tensormass::TetrahedralTensorMassForceField; #endif } // namespace sofa diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.inl diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cpp similarity index 99% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cpp index cd72f1ba968..ba63eeec4dd 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cpp @@ -21,7 +21,7 @@ ******************************************************************************/ #include "CudaHexahedronTLEDForceField.h" -#include "mycuda.h" +#include #include #include diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cu similarity index 99% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cu index ca8388a8242..3421032dbda 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.cu +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.cu @@ -23,7 +23,7 @@ #include #include #include "cuda.h" -#include "mycuda.h" +#include using namespace sofa::gpu::cuda; diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaHexahedronTLEDForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaHexahedronTLEDForceField.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cpp similarity index 99% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cpp index 082d53eb63f..6fac2ec3b68 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cpp @@ -24,7 +24,7 @@ #include -#include "mycuda.h" +#include #include #include #include diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cu similarity index 99% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cu index fece876f82b..9792fe39584 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.cu +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.cu @@ -26,7 +26,7 @@ #include #include "cuda.h" -#include "mycuda.h" +#include using namespace sofa::gpu::cuda; diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTetrahedronTLEDForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/tled/CudaTetrahedronTLEDForceField.h diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp similarity index 66% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp index fb40364e19d..863cb2c27d7 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cpp @@ -20,6 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #define SOFA_GPU_CUDA_CUDAMECHANICALOBJECT_CPP +#include #include #include @@ -29,21 +30,21 @@ namespace sofa::core { -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; #ifdef SOFA_GPU_CUDA_DOUBLE -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; -template struct SOFA_GPU_CUDA_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; +template struct SOFACUDA_COMPONENT_API AccumulationVecId; #endif // SOFA_GPU_CUDA_DOUBLE } @@ -51,21 +52,21 @@ namespace sofa::component::statecontainer { // template specialization must be in the same namespace as original namespace for GCC 4.1 // g++ 4.1 requires template instantiations to be declared on a parent namespace from the template class. -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; -template class SOFA_GPU_CUDA_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; +template class SOFACUDA_COMPONENT_API MechanicalObject; #endif // SOFA_GPU_CUDA_DOUBLE } // namespace sofa::component::statecontainer diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.cu diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.h similarity index 84% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.h index e82644cfc3a..366f86ce551 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.h @@ -21,6 +21,8 @@ ******************************************************************************/ #pragma once +#include + #include #include #include @@ -162,6 +164,8 @@ CudaMechanicalObject_DeclMethods(gpu::cuda::CudaRigid3dTypes) #ifndef SOFA_GPU_CUDA_CUDAMECHANICALOBJECT_CPP +namespace sofa::component::statecontainer +{ using sofa::gpu::cuda::CudaVec1fTypes; using sofa::gpu::cuda::CudaVec2fTypes; @@ -170,19 +174,15 @@ using sofa::gpu::cuda::CudaVec3f1Types; using sofa::gpu::cuda::CudaVec6fTypes; using sofa::gpu::cuda::CudaRigid3fTypes; using sofa::gpu::cuda::CudaRigid2fTypes; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; - -// template specialization must be in the same namespace as original namespace for GCC 4.1 -// g++ 4.1 requires template instantiations to be declared on a parent namespace from the template class. -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; #ifdef SOFA_GPU_CUDA_DOUBLE - using sofa::gpu::cuda::CudaVec1dTypes; using sofa::gpu::cuda::CudaVec2dTypes; using sofa::gpu::cuda::CudaVec3dTypes; @@ -190,13 +190,13 @@ using sofa::gpu::cuda::CudaVec3d1Types; using sofa::gpu::cuda::CudaVec6dTypes; using sofa::gpu::cuda::CudaRigid3dTypes; using sofa::gpu::cuda::CudaRigid2dTypes; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; -extern template class SOFA_GPU_CUDA_API sofa::component::statecontainer::MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; +extern template class SOFACUDA_COMPONENT_API MechanicalObject; #endif // SOFA_GPU_CUDA_DOUBLE - +} #endif // SOFA_GPU_CUDA_CUDAMECHANICALOBJECT_CPP diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/statecontainer/CudaMechanicalObject.inl diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSetTopology.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/topology/container/dynamic/CudaSetTopology.cpp similarity index 82% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSetTopology.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/topology/container/dynamic/CudaSetTopology.cpp index fecc1158cdd..62007af2b5e 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSetTopology.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/topology/container/dynamic/CudaSetTopology.cpp @@ -19,6 +19,8 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ +#include + #include #include #include @@ -54,60 +56,60 @@ using namespace sofa::core::behavior; //////// Point //////// //////////////////////////////// #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API PointSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API PointSetGeometryAlgorithms; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API PointSetGeometryAlgorithms; -template class SOFA_GPU_CUDA_API PointSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API PointSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API PointSetGeometryAlgorithms; //////////////////////////////// //////// Edge //////// //////////////////////////////// #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API EdgeSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API EdgeSetGeometryAlgorithms; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API EdgeSetGeometryAlgorithms; -template class SOFA_GPU_CUDA_API EdgeSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API EdgeSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API EdgeSetGeometryAlgorithms; //////////////////////////////// //////// Triangle //////// //////////////////////////////// #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TriangleSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API TriangleSetGeometryAlgorithms; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TriangleSetGeometryAlgorithms; -template class SOFA_GPU_CUDA_API TriangleSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API TriangleSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API TriangleSetGeometryAlgorithms; //////////////////////////////// //////// Quad //////// //////////////////////////////// #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API QuadSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API QuadSetGeometryAlgorithms; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API QuadSetGeometryAlgorithms; -template class SOFA_GPU_CUDA_API QuadSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API QuadSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API QuadSetGeometryAlgorithms; //////////////////////////////// //////// Tetrahedron //////// //////////////////////////////// #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TetrahedronSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API TetrahedronSetGeometryAlgorithms; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API TetrahedronSetGeometryAlgorithms; -template class SOFA_GPU_CUDA_API TetrahedronSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API TetrahedronSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API TetrahedronSetGeometryAlgorithms; //////////////////////////////// //////// Hexahedron //////// //////////////////////////////// #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API HexahedronSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API HexahedronSetGeometryAlgorithms; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API HexahedronSetGeometryAlgorithms; -template class SOFA_GPU_CUDA_API HexahedronSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API HexahedronSetGeometryAlgorithms; +template class SOFACUDA_COMPONENT_API HexahedronSetGeometryAlgorithms; } // namespace sofa::component::topology::container::dynamic diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.cpp diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.cu similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.cu diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.inl similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaVisualModel.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/visual/CudaVisualModel.inl diff --git a/applications/plugins/SofaCUDA/Core/CMakeLists.txt b/applications/plugins/SofaCUDA/Core/CMakeLists.txt new file mode 100644 index 00000000000..05e8d3c428c --- /dev/null +++ b/applications/plugins/SofaCUDA/Core/CMakeLists.txt @@ -0,0 +1,145 @@ +cmake_minimum_required(VERSION 3.22) +project(SofaCUDA.Core LANGUAGES CUDA CXX) + +set(SOFACUDA_CORE_MAJOR_VERSION 0) +set(SOFACUDA_CORE_MINOR_VERSION 1) +set(SOFACUDA_CORE_VERSION ${SOFACUDA_CORE_MAJOR_VERSION}.${SOFACUDA_CORE_MINOR_VERSION}) + +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + option(SOFACUDA_ENABLE_NATIVE_ARCHITECTURE "Set native as for CUDA_ARCHITECTURES (which will compile compatible architectures for the current system)") + if(SOFACUDA_ENABLE_NATIVE_ARCHITECTURE) + set(CMAKE_CUDA_ARCHITECTURES native) + endif() +endif() + +# set 75 as fallback value +if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) + message(NOTICE "CMAKE_CUDA_ARCHITECTURES is not set, it will be set by default to 75") + set(CMAKE_CUDA_ARCHITECTURES 75) +endif() + +set(SOFACUDA_CORE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") + +set(HEADER_FILES + ${SOFACUDA_CORE_SOURCE_DIR}/SofaCUDA/core/config.h.in + ${SOFACUDA_CORE_SOURCE_DIR}/SofaCUDA/core/init.h + + ### Core + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaBaseVector.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaCommon.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMath.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMath.inl + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMathRigid.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMathRigid.inl + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMatrix.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMemoryManager.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaScan.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSort.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaTypes.h + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/mycuda.h + + ### Mechanical + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSingleStateAccessor.h +) + +set(SOURCE_FILES + ${SOFACUDA_CORE_SOURCE_DIR}/SofaCUDA/core/init.cpp + + ### Core + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaBaseVector.cpp + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/mycuda.cpp + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSingleStateAccessor.cpp + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaMultiMapping.cpp +) + +set(CUDA_SOURCES + + ### Core + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/mycuda.cu + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaBaseVector.cu + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaScan.cu + ${SOFACUDA_CORE_SOURCE_DIR}/sofa/gpu/cuda/CudaSort.cu +) + +sofa_find_package(Sofa.GL REQUIRED) # mandatory for gl_interop, buffers.... +sofa_find_package(Sofa.Core REQUIRED) +sofa_find_package(Sofa.Component.Mass REQUIRED) # because of CudaMassType -> needs MassType (which should probably be moved into Sofa.Core) + +option(SOFACUDA_CORE_VERBOSE_PTXAS "???" OFF) + +option(SOFACUDA_CUBLAS "Activate cublas support in CUDA (requires SOFACUDA_DOUBLE)." OFF) +if(SOFACUDA_CUBLAS) + set(SOFA_GPU_CUBLAS 1) # #cmakedefine + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + find_package(CUDASparse REQUIRED) +endif() + +# Note: THRUST is included in CUDA SDK 4.0+, it is recommended to use it if available +option(SOFACUDA_THRUST "Activate THRUST (for RadixSort)." ON) +if(SOFACUDA_THRUST) + set(SOFA_GPU_THRUST 1) # #cmakedefine +endif() + +option(SOFACUDA_DOUBLE "Activate double-precision support in CUDA (requires GT200+ GPU and -arch sm_13 flag." OFF) +if(SOFACUDA_DOUBLE) + set(SOFA_GPU_CUDA_DOUBLE 1) # #cmakedefine +endif() + + +# Note: with SOFA_GPU_CUDA_PRECISE and SOFA_GPU_CUDA_DOUBLE you get IEEE +# 754-compliant floating point operations for addition and multiplication only. +option(SOFACUDA_PRECISE "Use IEEE 754-compliant floating point operations." OFF) +option(SOFACUDA_DOUBLE_PRECISE "Enable double-precision for sqrt/div..." OFF) +if(SOFACUDA_PRECISE) + set(SOFA_GPU_CUDA_PRECISE 1) # #cmakedefine +endif() +if(SOFACUDA_DOUBLE_PRECISE) + set(SOFA_GPU_CUDA_DOUBLE_PRECISE 1) # #cmakedefine +endif() + + +sofa_find_package(CUDAToolkit 11.0 REQUIRED) + +# nvcc uses a "host code compiler" to compile CPU code, specified by CUDA_HOST_COMPILER. +# With some versions of CMake, CUDA_HOST_COMPILER defaults to CMAKE_C_COMPILER, +# but few host compilers are actually supported. Workarounds should go here. +if (${CUDA_HOST_COMPILER} MATCHES "ccache$") + message(STATUS "SofaCUDA: CUDA host compiler was set to ccache, changing to g++") + set(CUDA_HOST_COMPILER "g++" CACHE STRING "Host side compiler used by NVCC" FORCE) +endif() + +add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES}) +set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${SOFACUDA_COMPILE_DEFINITIONS}") +if(SOFACUDA_VERBOSE_PTXAS) + target_compile_options(${PROJECT_NAME} PUBLIC $<$:--ptxas-options=-v>) +endif() +if(MSVC) + target_compile_options(${PROJECT_NAME} PUBLIC $<$:-Xcompiler /Zc:__cplusplus>) +endif() +if(WIN32) + target_compile_options(${PROJECT_NAME} PUBLIC $<$:-DWIN32>) +endif() + +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Core) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.GL) +target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.Mass) +target_link_libraries(${PROJECT_NAME} PUBLIC CUDA::cudart) + +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17 cuda_std_17) + +if(SOFACUDA_CUBLAS) + target_link_libraries(${PROJECT_NAME} ${CUDA_cusparse_LIBRARY} CUDA::cublas) +endif() + +# see (I guess) https://github.com/sofa-framework/sofa/blob/314b95cbfba411bf8431486ea75b7c67c0bbcc76/Sofa/framework/Config/cmake/SofaMacrosInstall.cmake#L695 +target_include_directories(${PROJECT_NAME} PUBLIC "$/include/${PROJECT_NAME}/${PROJECT_NAME}") + +## Install rules for the library and headers; CMake package configurations files +sofa_create_package_with_targets( + PACKAGE_NAME ${PROJECT_NAME} + PACKAGE_VERSION ${SOFACUDA_CORE_VERSION} + TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES + INCLUDE_INSTALL_DIR "${PROJECT_NAME}" + INCLUDE_SOURCE_DIR "src" + RELOCATABLE "plugins" +) diff --git a/applications/plugins/SofaCUDA/Core/SofaCUDA.CoreConfig.cmake.in b/applications/plugins/SofaCUDA/Core/SofaCUDA.CoreConfig.cmake.in new file mode 100644 index 00000000000..10a6a8768a8 --- /dev/null +++ b/applications/plugins/SofaCUDA/Core/SofaCUDA.CoreConfig.cmake.in @@ -0,0 +1,18 @@ +# CMake package configuration file for the SofaCUDA.Core plugin + +@PACKAGE_GUARD@ +@PACKAGE_INIT@ + +set(CMAKE_CUDA_ARCHITECTURES @CMAKE_CUDA_ARCHITECTURES@) + +find_package(Sofa.Config QUIET REQUIRED) + +sofa_find_package(Sofa.Core QUIET REQUIRED) +sofa_find_package(Sofa.GL QUIET REQUIRED) +sofa_find_package(Sofa.Component.Mass QUIET REQUIRED) + +if(NOT TARGET SofaCUDA) + include("${CMAKE_CURRENT_LIST_DIR}/SofaCUDA.CoreTargets.cmake") +endif() + +check_required_components(SofaCUDA.Core) diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaDataWidget.h b/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/config.h.in similarity index 62% rename from applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaDataWidget.h rename to applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/config.h.in index d3c2ad04c94..b9a7c3e611f 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaDataWidget.h +++ b/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/config.h.in @@ -20,43 +20,25 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include -#include -namespace sofa::qt -{ -//////////////////////////////////////////////////////////////// -/// variable-sized vectors support -//////////////////////////////////////////////////////////////// +#include +#include -template -class vector_data_trait < sofa::gpu::cuda::CudaVector > -{ -public: - typedef sofa::gpu::cuda::CudaVector data_type; - typedef T value_type; - enum { NDIM = 1 }; - static int size(const data_type& d) { - return d.size(); - } - static const char* header(const data_type& /*d*/, int /*i*/ = 0) - { - return nullptr; - } - static const value_type* get(const data_type& d, int i = 0) - { - return ((unsigned)i < (unsigned)size(d)) ? &(d[i]) : nullptr; - } - static void set(const value_type& v, data_type& d, int i = 0) - { - if ((unsigned)i < (unsigned)size(d)) - d[i] = v; - } - static void resize(int s, data_type& d) - { - d.resize(s); - } -}; +#cmakedefine SOFA_GPU_THRUST +#cmakedefine SOFA_GPU_CUDA_DOUBLE +#cmakedefine SOFA_GPU_CUDA_PRECISE +#cmakedefine SOFA_GPU_CUDA_DOUBLE_PRECISE +#cmakedefine SOFA_GPU_CUBLAS +#cmakedefine01 SOFACUDA_CORE_HAVE_SOFA_GL +#ifdef SOFA_BUILD_SOFACUDA_CORE +# define SOFACUDA_CORE_API SOFA_EXPORT_DYNAMIC_LIBRARY +#else +# define SOFACUDA_CORE_API SOFA_IMPORT_DYNAMIC_LIBRARY +#endif -} // namespace sofa::qt +namespace sofacuda::core +{ + constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; + constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; +} // namespace sofacuda::core diff --git a/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/init.cpp b/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/init.cpp new file mode 100644 index 00000000000..515bbd8385e --- /dev/null +++ b/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/init.cpp @@ -0,0 +1,89 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include + +#include +#include + +#include + +namespace sofacuda::core +{ + +extern "C" { + SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleLicense(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleDescription(); + SOFA_EXPORT_DYNAMIC_LIBRARY bool moduleIsInitialized(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); +} + +bool isModuleInitialized = false; + +void init() +{ + static bool first = true; + if (first) + { + isModuleInitialized = sofa::gpu::cuda::mycudaInit(); + first = false; + } +} + +void initExternalModule() +{ + init(); +} + +const char* getModuleName() +{ + return MODULE_NAME; +} + +const char* getModuleVersion() +{ + return MODULE_VERSION; +} + +const char* getModuleLicense() +{ + return "LGPL"; +} + +const char* getModuleDescription() +{ + return "A subset of SOFA componend using NVIDIA CUDA"; +} + +bool moduleIsInitialized() +{ + return isModuleInitialized; +} + +void registerObjects(sofa::core::ObjectFactory* factory) +{ + SOFA_UNUSED(factory); +} + +} // namespace sofacuda::core diff --git a/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/init.h b/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/init.h new file mode 100644 index 00000000000..871ed3fc113 --- /dev/null +++ b/applications/plugins/SofaCUDA/Core/src/SofaCUDA/core/init.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include + +namespace sofacuda::core +{ + SOFACUDA_CORE_API void init(); +} // namespace sofacuda::core diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.cpp b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.cpp similarity index 94% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.cpp rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.cpp index d924208b538..ca88bbf4591 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.cpp +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.cpp @@ -27,9 +27,9 @@ namespace sofa::gpu::cuda { -template class SOFA_GPU_CUDA_API CudaBaseVector< float >; +template class SOFACUDA_CORE_API CudaBaseVector< float >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API CudaBaseVector< double >; +template class SOFACUDA_CORE_API CudaBaseVector< double >; #endif } // namespace sofa::gpu::cuda diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.cu b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.cu similarity index 86% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.cu rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.cu index d18f302a97f..54f776164ab 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.cu +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.cu @@ -28,16 +28,16 @@ using namespace sofa::gpu::cuda; extern "C" { - void SOFA_GPU_CUDA_API copy_vectorf(int dim,const void * a, void * b); - void SOFA_GPU_CUDA_API vector_vector_peqf(int dim,float f,const void * a,void * b); - void SOFA_GPU_CUDA_API sub_vector_vectorf(int dim,const void * a, const void * b, void * r); - void SOFA_GPU_CUDA_API permute_vectorf(int dim,const void * a, const void * perm, void * b); + void SOFACUDA_CORE_API copy_vectorf(int dim,const void * a, void * b); + void SOFACUDA_CORE_API vector_vector_peqf(int dim,float f,const void * a,void * b); + void SOFACUDA_CORE_API sub_vector_vectorf(int dim,const void * a, const void * b, void * r); + void SOFACUDA_CORE_API permute_vectorf(int dim,const void * a, const void * perm, void * b); #ifdef SOFA_GPU_CUDA_DOUBLE - void SOFA_GPU_CUDA_API copy_vectord(int dim,const void * a, void * b); - void SOFA_GPU_CUDA_API vector_vector_peqd(int dim,double f,const void * a,void * b); - void SOFA_GPU_CUDA_API sub_vector_vectord(int dim,const void * a, const void * b, void * r); - void SOFA_GPU_CUDA_API permute_vectord(int dim,const void * a, const void * perm, void * b); + void SOFACUDA_CORE_API copy_vectord(int dim,const void * a, void * b); + void SOFACUDA_CORE_API vector_vector_peqd(int dim,double f,const void * a,void * b); + void SOFACUDA_CORE_API sub_vector_vectord(int dim,const void * a, const void * b, void * r); + void SOFACUDA_CORE_API permute_vectord(int dim,const void * a, const void * perm, void * b); #endif } @@ -50,7 +50,7 @@ __global__ void Cuda_CopyVector_kernel(int dim, const real * a, real * b) b[ti] = a[ti]; } -void SOFA_GPU_CUDA_API copy_vectorf(int dim,const void * a, void * b) +void SOFACUDA_CORE_API copy_vectorf(int dim,const void * a, void * b) { dim3 threads(BSIZE,1); dim3 grid((dim+BSIZE-1)/BSIZE,1); @@ -59,7 +59,7 @@ void SOFA_GPU_CUDA_API copy_vectorf(int dim,const void * a, void * b) } #ifdef SOFA_GPU_CUDA_DOUBLE -void SOFA_GPU_CUDA_API copy_vectord(int dim,const void * a, void * b) +void SOFACUDA_CORE_API copy_vectord(int dim,const void * a, void * b) { dim3 threads(BSIZE,1); dim3 grid((dim+BSIZE-1)/BSIZE,1); @@ -85,7 +85,7 @@ void vector_vector_peqf(int dim,float f,const void * a,void * b) } #ifdef SOFA_GPU_CUDA_DOUBLE -void SOFA_GPU_CUDA_API vector_vector_peqd(int dim,double f,const void * a,void * b) +void SOFACUDA_CORE_API vector_vector_peqd(int dim,double f,const void * a,void * b) { dim3 threads(BSIZE,1); dim3 grid((dim+BSIZE-1)/BSIZE,1); @@ -112,7 +112,7 @@ void sub_vector_vectorf(int dim,const void * a, const void * b, void * r) } #ifdef SOFA_GPU_CUDA_DOUBLE -void SOFA_GPU_CUDA_API sub_vector_vectord(int dim,const void * a, const void * b, void * r) +void SOFACUDA_CORE_API sub_vector_vectord(int dim,const void * a, const void * b, void * r) { dim3 threads(BSIZE,1); dim3 grid((dim+BSIZE-1)/BSIZE,1); @@ -139,7 +139,7 @@ void permute_vectorf(int dim,const void * a, const void * perm, void * b) } #ifdef SOFA_GPU_CUDA_DOUBLE -void SOFA_GPU_CUDA_API permute_vectord(int dim,const void * a, const void * perm, void * b) +void SOFACUDA_CORE_API permute_vectord(int dim,const void * a, const void * perm, void * b) { dim3 threads(BSIZE,1); dim3 grid((dim+BSIZE-1)/BSIZE,1); diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.h similarity index 92% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.h index 78bdfbda598..8a2d2a397e4 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaBaseVector.h +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaBaseVector.h @@ -35,16 +35,16 @@ namespace sofa::gpu::cuda extern "C" { - void SOFA_GPU_CUDA_API copy_vectorf(int dim,const void * a, void * b); - void SOFA_GPU_CUDA_API vector_vector_peqf(int dim,float f,const void * a,void * b); - void SOFA_GPU_CUDA_API sub_vector_vectorf(int dim,const void * a, const void * b, void * r); - void SOFA_GPU_CUDA_API permute_vectorf(int dim,const void * a, const void * perm, void * b); + void SOFACUDA_CORE_API copy_vectorf(int dim,const void * a, void * b); + void SOFACUDA_CORE_API vector_vector_peqf(int dim,float f,const void * a,void * b); + void SOFACUDA_CORE_API sub_vector_vectorf(int dim,const void * a, const void * b, void * r); + void SOFACUDA_CORE_API permute_vectorf(int dim,const void * a, const void * perm, void * b); #ifdef SOFA_GPU_CUDA_DOUBLE - void SOFA_GPU_CUDA_API copy_vectord(int dim,const void * a, void * b); - void SOFA_GPU_CUDA_API vector_vector_peqd(int dim,double f,const void * a,void * b); - void SOFA_GPU_CUDA_API sub_vector_vectord(int dim,const void * a, const void * b, void * r); - void SOFA_GPU_CUDA_API permute_vectord(int dim,const void * a, const void * perm, void * b); + void SOFACUDA_CORE_API copy_vectord(int dim,const void * a, void * b); + void SOFACUDA_CORE_API vector_vector_peqd(int dim,double f,const void * a,void * b); + void SOFACUDA_CORE_API sub_vector_vectord(int dim,const void * a, const void * b, void * r); + void SOFACUDA_CORE_API permute_vectord(int dim,const void * a, const void * perm, void * b); #endif } @@ -290,9 +290,9 @@ template<> inline const char* CudaBaseVectord::Name() { return "CudaBaseVectord" #if !defined(SOFA_BUILD_GPU_CUDA) -extern template class SOFA_GPU_CUDA_API CudaBaseVector< float >; +extern template class SOFACUDA_CORE_API CudaBaseVector< float >; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API CudaBaseVector< double >; +extern template class SOFACUDA_CORE_API CudaBaseVector< double >; #endif #endif diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaCommon.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaCommon.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaCommon.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaCommon.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMath.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMath.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMath.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMath.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMath.inl b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMath.inl similarity index 99% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMath.inl rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMath.inl index 0090825f1e5..f502f842c5b 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMath.inl +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMath.inl @@ -23,7 +23,7 @@ #define CUDAMATH_INL #include -#include +#include #ifdef SOFA_GPU_CUDA_PRECISE template<> diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMathRigid.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMathRigid.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMathRigid.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMathRigid.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMathRigid.inl b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMathRigid.inl similarity index 98% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMathRigid.inl rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMathRigid.inl index 8cfe9afe123..faeee7b710d 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMathRigid.inl +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMathRigid.inl @@ -23,7 +23,7 @@ #define CUDAMATHRIGID_INL #include "CudaMathRigid.h" -#include +#include #ifdef SOFA_GPU_CUDA_PRECISE template<> diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMatrix.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMatrix.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMatrix.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMatrix.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMemoryManager.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMemoryManager.h similarity index 89% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMemoryManager.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMemoryManager.h index e4e338583ad..85ee495f720 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMemoryManager.h +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMemoryManager.h @@ -26,9 +26,9 @@ #include #include "mycuda.h" -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 #include -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 namespace sofa::gpu::cuda { @@ -41,9 +41,9 @@ class CudaMemoryManager : public sofa::helper::MemoryManager public : typedef T* host_pointer; typedef /*mutable*/ void* device_pointer; -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 typedef GLuint gl_buffer; -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 enum { MAX_DEVICES = 8 }; enum { BSIZE = 64 }; @@ -105,7 +105,7 @@ public : static bool bufferAlloc(gl_buffer* bId, int n, bool createBuffer = true) { -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 if (n > 0) { if(createBuffer) @@ -116,47 +116,47 @@ public : glBindBuffer( GL_ARRAY_BUFFER, 0); return true; } -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 return false; } static void bufferFree(const gl_buffer bId) { -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 glDeleteBuffers( 1, &bId); -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 } static bool bufferRegister(const gl_buffer bId) { -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 mycudaGLRegisterBufferObject(bId); -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 return true; } static void bufferUnregister(const gl_buffer bId) { -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 mycudaGLUnregisterBufferObject(bId); -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 } static bool bufferMapToDevice(device_pointer * dDestPointer, const gl_buffer bSrcId) { -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 mycudaGLMapBufferObject(dDestPointer, bSrcId); return true; #else return false; -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 } static void bufferUnmapToDevice(device_pointer * /*dDestPointer*/, const gl_buffer bSrcId) { -#if SOFACUDA_HAVE_SOFA_GL == 1 +#if SOFACUDA_CORE_HAVE_SOFA_GL == 1 mycudaGLUnmapBufferObject(bSrcId); -#endif // SOFACUDA_HAVE_SOFA_GL == 1 +#endif // SOFACUDA_CORE_HAVE_SOFA_GL == 1 } static device_pointer deviceOffset(device_pointer dPointer,size_t offset) diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMultiMapping.cpp b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMultiMapping.cpp similarity index 59% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMultiMapping.cpp rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMultiMapping.cpp index 5c863a29381..eb63fc5db17 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaMultiMapping.cpp +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaMultiMapping.cpp @@ -26,36 +26,36 @@ namespace sofa::core { using namespace sofa::gpu::cuda; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec1Types, CudaVec1Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec2Types, CudaVec1Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec3Types, CudaVec3Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec3Types, CudaVec2Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec3Types, CudaVec1Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec6Types, CudaVec1Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3Types, CudaVec1Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3Types, CudaVec3Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3Types, CudaVec6Types >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3Types, CudaRigid3Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec1Types, CudaVec1Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec2Types, CudaVec1Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec3Types, CudaVec3Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec3Types, CudaVec2Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec3Types, CudaVec1Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec6Types, CudaVec1Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3Types, CudaVec1Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3Types, CudaVec3Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3Types, CudaVec6Types >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3Types, CudaRigid3Types >; - template class SOFA_GPU_CUDA_API MultiMapping; - template class SOFA_GPU_CUDA_API MultiMapping; - template class SOFA_GPU_CUDA_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; #ifdef SOFA_GPU_CUDA_DOUBLE - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec1dTypes, CudaVec1dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec2dTypes, CudaVec1dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec3dTypes, CudaVec3dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec3dTypes, CudaVec2dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec3dTypes, CudaVec1dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaVec6dTypes, CudaVec1dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3dTypes, CudaVec1dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3dTypes, CudaVec3dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3dTypes, CudaVec6dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping< CudaRigid3dTypes, CudaRigid3dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec1dTypes, CudaVec1dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec2dTypes, CudaVec1dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec3dTypes, CudaVec3dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec3dTypes, CudaVec2dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec3dTypes, CudaVec1dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaVec6dTypes, CudaVec1dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3dTypes, CudaVec1dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3dTypes, CudaVec3dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3dTypes, CudaVec6dTypes >; + template class SOFACUDA_CORE_API MultiMapping< CudaRigid3dTypes, CudaRigid3dTypes >; - template class SOFA_GPU_CUDA_API MultiMapping; - template class SOFA_GPU_CUDA_API MultiMapping; - template class SOFA_GPU_CUDA_API MultiMapping; - template class SOFA_GPU_CUDA_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; + template class SOFACUDA_CORE_API MultiMapping; #endif } // namespace sofa::core diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaScan.cu b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaScan.cu similarity index 98% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaScan.cu rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaScan.cu index 8069c6915ef..489be8d584d 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaScan.cu +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaScan.cu @@ -46,8 +46,8 @@ enum ScanType extern "C" { - bool SOFA_GPU_CUDA_API CudaScanGPUAvailable(unsigned int size, ScanType type); - bool SOFA_GPU_CUDA_API CudaScanGPU(const void* input, void* output, unsigned int size, ScanType type); + bool SOFACUDA_CORE_API CudaScanGPUAvailable(unsigned int size, ScanType type); + bool SOFACUDA_CORE_API CudaScanGPU(const void* input, void* output, unsigned int size, ScanType type); } // "C" diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaScan.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaScan.h similarity index 96% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaScan.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaScan.h index 3215f6c4bdf..d85f896f5a1 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaScan.h +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaScan.h @@ -44,8 +44,8 @@ enum ScanType extern "C" { - extern bool SOFA_GPU_CUDA_API CudaScanGPUAvailable(unsigned int size, ScanType type); - extern bool SOFA_GPU_CUDA_API CudaScanGPU(const void* input, void* output, unsigned int size, ScanType type); + extern bool SOFACUDA_CORE_API CudaScanGPUAvailable(unsigned int size, ScanType type); + extern bool SOFACUDA_CORE_API CudaScanGPU(const void* input, void* output, unsigned int size, ScanType type); } // "C" diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSingleStateAccessor.cpp b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSingleStateAccessor.cpp similarity index 70% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSingleStateAccessor.cpp rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSingleStateAccessor.cpp index 958b7c63da2..9bfa0b365a1 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSingleStateAccessor.cpp +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSingleStateAccessor.cpp @@ -33,20 +33,20 @@ namespace sofa::core::behavior using namespace sofa::gpu::cuda; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; #endif // SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; -template class SOFA_GPU_CUDA_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; +template class SOFACUDA_CORE_API SingleStateAccessor; } // namespace sofa::core::behavior diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSingleStateAccessor.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSingleStateAccessor.h similarity index 70% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSingleStateAccessor.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSingleStateAccessor.h index aa8249a59e7..cb4d0027463 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSingleStateAccessor.h +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSingleStateAccessor.h @@ -30,21 +30,21 @@ namespace sofa::core::behavior using namespace sofa::gpu::cuda; #ifdef SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; #endif // SOFA_GPU_CUDA_DOUBLE -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; -extern template class SOFA_GPU_CUDA_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; +extern template class SOFACUDA_CORE_API SingleStateAccessor; #endif diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSort.cu b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSort.cu similarity index 97% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSort.cu rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSort.cu index d8689acf63c..d19307e9e90 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSort.cu +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSort.cu @@ -48,8 +48,8 @@ namespace cuda extern "C" { - bool SOFA_GPU_CUDA_API CudaSortGPUAvailable(unsigned int size, bool withData = true); - bool SOFA_GPU_CUDA_API CudaSortGPU(void* keys, void* data, unsigned int size, int bits); + bool SOFACUDA_CORE_API CudaSortGPUAvailable(unsigned int size, bool withData = true); + bool SOFACUDA_CORE_API CudaSortGPU(void* keys, void* data, unsigned int size, int bits); } // "C" diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSort.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSort.h similarity index 96% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSort.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSort.h index 8d112ad16a5..8bdc2cfa006 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaSort.h +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaSort.h @@ -38,8 +38,8 @@ namespace sofa::gpu::cuda extern "C" { - extern bool SOFA_GPU_CUDA_API CudaSortGPUAvailable(unsigned int size, bool withData = true); - extern bool SOFA_GPU_CUDA_API CudaSortGPU(void* keys, void* data, unsigned int size, int bits); + extern bool SOFACUDA_CORE_API CudaSortGPUAvailable(unsigned int size, bool withData = true); + extern bool SOFACUDA_CORE_API CudaSortGPU(void* keys, void* data, unsigned int size, int bits); } // "C" diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTypes.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaTypes.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/CudaTypes.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/CudaTypes.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/GPUDetectionOutputVector.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/GPUDetectionOutputVector.h similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/GPUDetectionOutputVector.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/GPUDetectionOutputVector.h diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.cpp b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.cpp similarity index 100% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.cpp rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.cpp diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.cu b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.cu similarity index 99% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.cu rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.cu index 394b5837159..61934bfcb6d 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.cu +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.cu @@ -47,7 +47,7 @@ namespace cuda extern "C" { - int SOFA_GPU_CUDA_API mycudaGetMultiProcessorCount(); + int SOFACUDA_CORE_API mycudaGetMultiProcessorCount(); void cuda_void_kernel(); } @@ -394,7 +394,7 @@ cusparseMatDescr_t getCusparseMatTriangularUpperDescr() return matdescTriUpper; } -void SOFA_GPU_CUDA_API mycudaMemGetInfo(size_t * free,size_t * total) { +void SOFACUDA_CORE_API mycudaMemGetInfo(size_t * free,size_t * total) { cudaMemGetInfo(free,total); } diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.h b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.h similarity index 63% rename from applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.h rename to applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.h index 7965674673f..e9967f83876 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/cuda/mycuda.h +++ b/applications/plugins/SofaCUDA/Core/src/sofa/gpu/cuda/mycuda.h @@ -22,7 +22,7 @@ #ifndef MYCUDA_H #define MYCUDA_H -#include +#include #include #ifdef SOFA_GPU_CUBLAS @@ -46,48 +46,48 @@ namespace cuda extern "C" { - extern SOFA_GPU_CUDA_API int mycudaGetnumDevices(); - extern SOFA_GPU_CUDA_API int mycudaGetBufferDevice(); - - extern int SOFA_GPU_CUDA_API mycudaInit(int device=-1); - extern void SOFA_GPU_CUDA_API mycudaMalloc(void **devPtr, size_t size,int d = mycudaGetBufferDevice()); - extern void SOFA_GPU_CUDA_API mycudaMallocPitch(void **devPtr, size_t* pitch, size_t width, size_t height); - extern void SOFA_GPU_CUDA_API mycudaFree(void *devPtr,int d = mycudaGetBufferDevice()); - extern void SOFA_GPU_CUDA_API mycudaMallocHost(void **hostPtr, size_t size); - extern void SOFA_GPU_CUDA_API mycudaFreeHost(void *hostPtr); -//extern void SOFA_GPU_CUDA_API mycudaMemcpy(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind); - extern void SOFA_GPU_CUDA_API mycudaMemcpyHostToDevice(void *dst, const void *src, size_t count,int d = mycudaGetBufferDevice()); - extern void SOFA_GPU_CUDA_API mycudaMemcpyDeviceToDevice(void *dst, const void *src, size_t count,int d = mycudaGetBufferDevice()); - extern void SOFA_GPU_CUDA_API mycudaMemcpyDeviceToHost(void *dst, const void *src, size_t count,int d = mycudaGetBufferDevice()); - extern void SOFA_GPU_CUDA_API mycudaMemcpyHostToDevice2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height); - extern void SOFA_GPU_CUDA_API mycudaMemcpyDeviceToDevice2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height); - extern void SOFA_GPU_CUDA_API mycudaMemcpyDeviceToHost2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height); - - extern void SOFA_GPU_CUDA_API mycudaGLRegisterBufferObject(int id); - extern void SOFA_GPU_CUDA_API mycudaGLUnregisterBufferObject(int id); - - extern void SOFA_GPU_CUDA_API mycudaGLMapBufferObject(void** ptr, int id); - extern void SOFA_GPU_CUDA_API mycudaGLUnmapBufferObject(int id); - - extern void SOFA_GPU_CUDA_API mycudaMemset(void * devPtr, int val , size_t size,int d = mycudaGetBufferDevice()); - - extern void SOFA_GPU_CUDA_API mycudaThreadSynchronize(); - extern void SOFA_GPU_CUDA_API mycudaDeviceSynchronize(); + extern SOFACUDA_CORE_API int mycudaGetnumDevices(); + extern SOFACUDA_CORE_API int mycudaGetBufferDevice(); + + extern int SOFACUDA_CORE_API mycudaInit(int device=-1); + extern void SOFACUDA_CORE_API mycudaMalloc(void **devPtr, size_t size,int d = mycudaGetBufferDevice()); + extern void SOFACUDA_CORE_API mycudaMallocPitch(void **devPtr, size_t* pitch, size_t width, size_t height); + extern void SOFACUDA_CORE_API mycudaFree(void *devPtr,int d = mycudaGetBufferDevice()); + extern void SOFACUDA_CORE_API mycudaMallocHost(void **hostPtr, size_t size); + extern void SOFACUDA_CORE_API mycudaFreeHost(void *hostPtr); +//extern void SOFACUDA_CORE_API mycudaMemcpy(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind); + extern void SOFACUDA_CORE_API mycudaMemcpyHostToDevice(void *dst, const void *src, size_t count,int d = mycudaGetBufferDevice()); + extern void SOFACUDA_CORE_API mycudaMemcpyDeviceToDevice(void *dst, const void *src, size_t count,int d = mycudaGetBufferDevice()); + extern void SOFACUDA_CORE_API mycudaMemcpyDeviceToHost(void *dst, const void *src, size_t count,int d = mycudaGetBufferDevice()); + extern void SOFACUDA_CORE_API mycudaMemcpyHostToDevice2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height); + extern void SOFACUDA_CORE_API mycudaMemcpyDeviceToDevice2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height); + extern void SOFACUDA_CORE_API mycudaMemcpyDeviceToHost2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height); + + extern void SOFACUDA_CORE_API mycudaGLRegisterBufferObject(int id); + extern void SOFACUDA_CORE_API mycudaGLUnregisterBufferObject(int id); + + extern void SOFACUDA_CORE_API mycudaGLMapBufferObject(void** ptr, int id); + extern void SOFACUDA_CORE_API mycudaGLUnmapBufferObject(int id); + + extern void SOFACUDA_CORE_API mycudaMemset(void * devPtr, int val , size_t size,int d = mycudaGetBufferDevice()); + + extern void SOFACUDA_CORE_API mycudaThreadSynchronize(); + extern void SOFACUDA_CORE_API mycudaDeviceSynchronize(); - extern void SOFA_GPU_CUDA_API mycudaCheckError(const char* src); + extern void SOFACUDA_CORE_API mycudaCheckError(const char* src); - extern void SOFA_GPU_CUDA_API displayStack(const char * name); + extern void SOFACUDA_CORE_API displayStack(const char * name); - extern void SOFA_GPU_CUDA_API mycudaMemGetInfo(size_t * free,size_t * total); + extern void SOFACUDA_CORE_API mycudaMemGetInfo(size_t * free,size_t * total); #ifdef SOFA_GPU_CUBLAS - extern cusparseHandle_t SOFA_GPU_CUDA_API getCusparseCtx(); - extern cublasHandle_t SOFA_GPU_CUDA_API getCublasCtx(); - extern cusparseMatDescr_t SOFA_GPU_CUDA_API getCusparseMatGeneralDescr(); - extern cusparseMatDescr_t SOFA_GPU_CUDA_API getCusparseMatTriangularUpperDescr(); - extern cusparseMatDescr_t SOFA_GPU_CUDA_API getCusparseMatTriangularLowerDescr(); + extern cusparseHandle_t SOFACUDA_CORE_API getCusparseCtx(); + extern cublasHandle_t SOFACUDA_CORE_API getCublasCtx(); + extern cusparseMatDescr_t SOFACUDA_CORE_API getCusparseMatGeneralDescr(); + extern cusparseMatDescr_t SOFACUDA_CORE_API getCusparseMatTriangularUpperDescr(); + extern cusparseMatDescr_t SOFACUDA_CORE_API getCusparseMatTriangularLowerDescr(); #endif #if defined(NDEBUG) && !defined(CUDA_DEBUG) @@ -99,10 +99,10 @@ extern "C" { // To add a call to mycudaDebugError after all kernel launches in a file, you can use : // sed -i.bak -e 's/\([ \t]\)\([_A-Za-z][_A-Za-z0-9]*[ \t]*\(<[_A-Za-z0-9 :,().+*\/|&^-]*\(<[_A-Za-z0-9 :,().+*\/|&^-]*>[_A-Za-z0-9 :,().+*\/|&^-]*\)*>\)\?[:space:]*\)<<>>[^;]*\);/{\1\2\3; mycudaDebugError("\1");}/g' -e 's/###\([^;#]*\)###\(<<<\)/\1\2/g' myfile.cu - extern void SOFA_GPU_CUDA_API mycudaLogError(const char* err, const char* src); - extern int SOFA_GPU_CUDA_API mycudaPrintf(const char* fmt, ...); - extern int SOFA_GPU_CUDA_API mycudaPrintfError(const char* fmt, ...); - extern int SOFA_GPU_CUDA_API mycudaGetMultiProcessorCount(); + extern void SOFACUDA_CORE_API mycudaLogError(const char* err, const char* src); + extern int SOFACUDA_CORE_API mycudaPrintf(const char* fmt, ...); + extern int SOFACUDA_CORE_API mycudaPrintfError(const char* fmt, ...); + extern int SOFACUDA_CORE_API mycudaGetMultiProcessorCount(); extern void mycudaPrivateInit(int device=-1); extern void cuda_void_kernel(); @@ -119,7 +119,7 @@ extern "C" { LOG_STACK_TRACE = 4 }; - extern MycudaVerboseLevel SOFA_GPU_CUDA_API mycudaVerboseLevel; + extern MycudaVerboseLevel SOFACUDA_CORE_API mycudaVerboseLevel; } diff --git a/applications/plugins/SofaCUDA/SofaCUDAConfig.cmake.in b/applications/plugins/SofaCUDA/SofaCUDAConfig.cmake.in index e2a63da4672..1464a3fed61 100644 --- a/applications/plugins/SofaCUDA/SofaCUDAConfig.cmake.in +++ b/applications/plugins/SofaCUDA/SofaCUDAConfig.cmake.in @@ -3,40 +3,9 @@ @PACKAGE_GUARD@ @PACKAGE_INIT@ -list(FIND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" HAS_SOFACUDA_CMAKE_MODULE_PATH) -if(HAS_SOFACUDA_CMAKE_MODULE_PATH EQUAL -1) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) -endif() +find_package(Sofa.Config QUIET REQUIRED) -set(CMAKE_CUDA_ARCHITECTURES @CMAKE_CUDA_ARCHITECTURES@) - -find_package(Sofa.Component.Mass QUIET REQUIRED) -find_package(Sofa.Component.SolidMechanics.FEM.Elastic QUIET REQUIRED) -find_package(Sofa.Component.SolidMechanics.FEM.HyperElastic QUIET REQUIRED) -find_package(Sofa.Component.SolidMechanics.TensorMass QUIET REQUIRED) -find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED) -find_package(Sofa.Component.Collision.Detection.Intersection QUIET REQUIRED) -find_package(Sofa.Component.StateContainer QUIET REQUIRED) -find_package(Sofa.Component.Constraint.Projective QUIET REQUIRED) -find_package(Sofa.Component.Mapping.Linear QUIET REQUIRED) -find_package(Sofa.Component.Mapping.NonLinear QUIET REQUIRED) -find_package(Sofa.Component.Engine.Select QUIET REQUIRED) -find_package(Sofa.Component.Engine.Transform QUIET REQUIRED) -find_package(Sofa.Component.MechanicalLoad QUIET REQUIRED) - - -set(SOFACUDA_HAVE_SOFA_GL @SOFACUDA_HAVE_SOFA_GL@) -if(SOFACUDA_HAVE_SOFA_GL) - find_package(Sofa.GL QUIET REQUIRED) -endif() - -set(SOFACUDA_HAVE_SOFA_GUI_QT @SOFACUDA_HAVE_SOFA_GUI_QT@) -if(SOFACUDA_HAVE_SOFA_GUI_QT) - find_package(Sofa.Qt QUIET REQUIRED) -endif() - -if(NOT TARGET SofaCUDA) - include("${CMAKE_CURRENT_LIST_DIR}/SofaCUDATargets.cmake") -endif() +sofa_find_package(SofaCUDA.Core QUIET REQUIRED) +sofa_find_package(SofaCUDA.Component QUIET REQUIRED) check_required_components(SofaCUDA) diff --git a/applications/plugins/SofaCUDA/extensions/CMakeLists.txt b/applications/plugins/SofaCUDA/extensions/CMakeLists.txt new file mode 100644 index 00000000000..a734ea83ea3 --- /dev/null +++ b/applications/plugins/SofaCUDA/extensions/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.12) + +find_package(Sofa.Config) + +sofa_add_subdirectory(plugin GUI SofaCUDA.GUI) + diff --git a/applications/plugins/SofaCUDA/extensions/GUI/CMakeLists.txt b/applications/plugins/SofaCUDA/extensions/GUI/CMakeLists.txt new file mode 100644 index 00000000000..56ebff02646 --- /dev/null +++ b/applications/plugins/SofaCUDA/extensions/GUI/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.12) +project(SofaCUDA.GUI LANGUAGES CXX CUDA) + +set(SOFACUDAGUI_SOURCE_DIR "src/SofaCUDA/GUI") +set(HEADER_FILES + ${SOFACUDAGUI_SOURCE_DIR}/init.h + ${SOFACUDAGUI_SOURCE_DIR}/config.h.in +) + +set(SOURCE_FILES + ${SOFACUDAGUI_SOURCE_DIR}/init.cpp + ${SOFACUDAGUI_SOURCE_DIR}/CudaMouseInteraction.cpp +) + +sofa_find_package(SofaCUDA REQUIRED) +sofa_find_package(Sofa.GUI.Common REQUIRED) + +add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) +target_link_libraries(${PROJECT_NAME} SofaCUDA) +target_link_libraries(${PROJECT_NAME} Sofa.GUI.Common) + +sofa_create_package_with_targets( + PACKAGE_NAME ${PROJECT_NAME} + PACKAGE_VERSION ${Sofa_VERSION} + TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES + INCLUDE_SOURCE_DIR "src" + INCLUDE_INSTALL_DIR "${PROJECT_NAME}" + RELOCATABLE "plugins" +) diff --git a/applications/plugins/SofaCUDA/extensions/GUI/SofaCUDA.GUIConfig.cmake.in b/applications/plugins/SofaCUDA/extensions/GUI/SofaCUDA.GUIConfig.cmake.in new file mode 100644 index 00000000000..43eb9422290 --- /dev/null +++ b/applications/plugins/SofaCUDA/extensions/GUI/SofaCUDA.GUIConfig.cmake.in @@ -0,0 +1,9 @@ +# CMake package configuration file for the SofaCUDA.GUI library + +@PACKAGE_GUARD@ +@PACKAGE_INIT@ + +find_package(Sofa.GUI.Common QUIET REQUIRED) +find_package(SofaCUDA QUIET REQUIRED) + +check_required_components(SofaCUDA.GUI) diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaMouseInteraction.cpp b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/CudaMouseInteraction.cpp similarity index 66% rename from applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaMouseInteraction.cpp rename to applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/CudaMouseInteraction.cpp index 3dba09a28d5..c2a148b09ce 100644 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaMouseInteraction.cpp +++ b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/CudaMouseInteraction.cpp @@ -1,45 +1,36 @@ +#include + #include -#include -#include -#include -#include -#include #include -#include +#include #include #include #include #include -#include -#include - -#include -#include -#include - -#include #include -#include -#include +#include + namespace sofa::gui::component::performer { -template class SOFA_GPU_CUDA_API MouseInteractor; -template class SOFA_GPU_CUDA_API TComponentMouseInteraction< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API AttachBodyPerformer< CudaVec3fTypes >; -template class SOFA_GPU_CUDA_API FixParticlePerformer< CudaVec3fTypes >; + +using namespace sofa::gpu::cuda; + +template class SOFACUDA_GUI_API MouseInteractor; +template class SOFACUDA_GUI_API TComponentMouseInteraction< CudaVec3fTypes >; +template class SOFACUDA_GUI_API AttachBodyPerformer< CudaVec3fTypes >; +template class SOFACUDA_GUI_API FixParticlePerformer< CudaVec3fTypes >; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFA_GPU_CUDA_API MouseInteractor; -template class SOFA_GPU_CUDA_API TComponentMouseInteraction< CudaVec3dTypes >; -template class SOFA_GPU_CUDA_API AttachBodyPerformer< CudaVec3dTypes >; -template class SOFA_GPU_CUDA_API FixParticlePerformer< CudaVec3dTypes >; +template class SOFACUDA_GUI_API MouseInteractor; +template class SOFACUDA_GUI_API TComponentMouseInteraction< CudaVec3dTypes >; +template class SOFACUDA_GUI_API AttachBodyPerformer< CudaVec3dTypes >; +template class SOFACUDA_GUI_API FixParticlePerformer< CudaVec3dTypes >; #endif -using namespace sofa::gpu::cuda; using namespace sofa::component::collision; using namespace sofa::component::collision::geometry; using namespace sofa::component::collision::response::mapper; diff --git a/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/config.h.in b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/config.h.in new file mode 100644 index 00000000000..adfc2d35210 --- /dev/null +++ b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/config.h.in @@ -0,0 +1,45 @@ +/****************************************************************************** +* BeamAdapter plugin * +* (c) 2006 Inria, University of Lille, CNRS * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: see Authors.md * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include +#include + +#cmakedefine SOFA_GPU_THRUST +#cmakedefine SOFA_GPU_CUDA_DOUBLE +#cmakedefine SOFA_GPU_CUDA_PRECISE +#cmakedefine SOFA_GPU_CUDA_DOUBLE_PRECISE +#cmakedefine SOFA_GPU_CUBLAS +#define SOFACUDA_GUI_VERSION @PROJECT_VERSION@ + +#ifdef SOFA_BUILD_SOFACUDA_GUI +# define SOFA_TARGET @PROJECT_NAME@ +# define SOFACUDA_GUI_API SOFA_EXPORT_DYNAMIC_LIBRARY +#else +# define SOFACUDA_GUI_API SOFA_IMPORT_DYNAMIC_LIBRARY +#endif + +namespace sofa::gpu::cuda::gui +{ + constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; + constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; +} // namespace sofa::gpu::cuda::gui diff --git a/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/init.cpp b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/init.cpp new file mode 100644 index 00000000000..72d851f9f6a --- /dev/null +++ b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/init.cpp @@ -0,0 +1,91 @@ +/****************************************************************************** +* BeamAdapter plugin * +* (c) 2006 Inria, University of Lille, CNRS * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: see Authors.md * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#include + +#include +#include + + +namespace sofa::gpu::cuda +{ + +extern void registerMouseInteractor(sofa::core::ObjectFactory* factory); + +} + +namespace sofa::gpu::cuda::gui +{ + +extern "C" { + SOFACUDA_GUI_API void initExternalModule(); + SOFACUDA_GUI_API const char* getModuleLicense(); + SOFACUDA_GUI_API const char* getModuleName(); + SOFACUDA_GUI_API const char* getModuleVersion(); + SOFACUDA_GUI_API const char* getModuleDescription(); + SOFACUDA_GUI_API void registerObjects(sofa::core::ObjectFactory* factory); +} + +void init() +{ + static bool first = true; + if (first) + { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } +} + +//Here are just several convenient functions to help user to know what contains the plugin + +void initExternalModule() +{ + init(); +} + +const char* getModuleLicense() +{ + return "LGPL"; +} + +const char* getModuleName() +{ + return MODULE_NAME; +} + +const char* getModuleVersion() +{ + return MODULE_VERSION; +} + +const char* getModuleDescription() +{ + return "OpenGL extension of the SofaCUDA plugin."; +} + +void registerObjects(sofa::core::ObjectFactory* factory) +{ + sofa::gpu::cuda::registerMouseInteractor(factory); +} + +} // namespace sofa::gpu::cuda::gl diff --git a/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/init.h b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/init.h new file mode 100644 index 00000000000..66bc67302ef --- /dev/null +++ b/applications/plugins/SofaCUDA/extensions/GUI/src/SofaCUDA/GUI/init.h @@ -0,0 +1,30 @@ +/****************************************************************************** +* BeamAdapter plugin * +* (c) 2006 Inria, University of Lille, CNRS * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: see Authors.md * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once +#include + +namespace sofa::gpu::cuda::gui +{ + +void SOFACUDA_GUI_API init(); + +} // namespace sofa::gpu::cuda::gui diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/config.h.in b/applications/plugins/SofaCUDA/src/SofaCUDA/config.h.in index 7e9ff0bace5..07ec13bb752 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/config.h.in +++ b/applications/plugins/SofaCUDA/src/SofaCUDA/config.h.in @@ -22,26 +22,16 @@ #pragma once #include - -#define SOFACUDA_MAJOR_VERSION ${SOFACUDA_MAJOR_VERSION} -#define SOFACUDA_MINOR_VERSION ${SOFACUDA_MINOR_VERSION} - -#cmakedefine SOFA_GPU_THRUST -#cmakedefine SOFA_GPU_CUDA_DOUBLE -#cmakedefine SOFA_GPU_CUDA_PRECISE -#cmakedefine SOFA_GPU_CUDA_DOUBLE_PRECISE -#cmakedefine SOFA_GPU_CUBLAS -#cmakedefine01 SOFACUDA_HAVE_SOFA_GL +#include #ifdef SOFA_BUILD_SOFACUDA -# define SOFA_TARGET SofaCUDA -# define SOFA_GPU_CUDA_API SOFA_EXPORT_DYNAMIC_LIBRARY +# define SOFACUDA_API SOFA_EXPORT_DYNAMIC_LIBRARY #else -# define SOFA_GPU_CUDA_API SOFA_IMPORT_DYNAMIC_LIBRARY +# define SOFACUDA_API SOFA_IMPORT_DYNAMIC_LIBRARY #endif -namespace sofa::gpu::cuda +namespace sofacuda { - constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; - constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; -} // namespace sofa::gpu::cuda + constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; + constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; +} // namespace sofacuda diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/init.cpp b/applications/plugins/SofaCUDA/src/SofaCUDA/init.cpp index 80453cbf2dd..961f7f2b06d 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/init.cpp +++ b/applications/plugins/SofaCUDA/src/SofaCUDA/init.cpp @@ -19,137 +19,22 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include #include -#include -#include - -namespace sofa::gpu::cuda -{ - -// component::collision::geometry -extern void registerLineCollisionModel(sofa::core::ObjectFactory* factory); -extern void registerPointCollisionModel(sofa::core::ObjectFactory* factory); -extern void registerSphereCollisionModel(sofa::core::ObjectFactory* factory); -extern void registerTriangleCollisionModel(sofa::core::ObjectFactory* factory); - -// component::collision::response::contact -extern void registerPenalityContactForceField(sofa::core::ObjectFactory* factory); - -// component::constraint::lagrangian::correction -extern void registerLinearSolverConstraintCorrection(sofa::core::ObjectFactory* factory); -extern void registerPrecomputedConstraintCorrection(sofa::core::ObjectFactory* factory); -extern void registerUncoupledConstraintCorrection(sofa::core::ObjectFactory* factory); - -// component::constraint::lagrangian::model -extern void registerBilateralLagrangianConstraint(sofa::core::ObjectFactory* factory); - -// component::constraint::projective -extern void registerFixedProjectiveConstraint(sofa::core::ObjectFactory* factory); -extern void registerFixedTranslationProjectiveConstraint(sofa::core::ObjectFactory* factory); -extern void registerLinearMovementProjectiveConstraint(sofa::core::ObjectFactory* factory); -extern void registerLinearVelocityProjectiveConstraint(sofa::core::ObjectFactory* factory); - -// component::engine::select -extern void registerBoxROI(sofa::core::ObjectFactory* factory); -extern void registerNearestPointROI(sofa::core::ObjectFactory* factory); -extern void registerSphereROI(sofa::core::ObjectFactory* factory); - -// component::engine::transform -extern void registerIndexValueMapper(sofa::core::ObjectFactory* factory); - -// component::mapping::linear -extern void registerBarycentricMapping(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_f(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_3fRigid(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_3f(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_3f1(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_3f1_f(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_3f1_3f(sofa::core::ObjectFactory* factory); -extern void registerBarycentricMapping_3f1_d(sofa::core::ObjectFactory* factory); -extern void registerBeamLinearMapping(sofa::core::ObjectFactory* factory); -extern void registerIdentityMapping(sofa::core::ObjectFactory* factory); -extern void registerSubsetMapping(sofa::core::ObjectFactory* factory); -extern void registerSubsetMultiMapping(sofa::core::ObjectFactory* factory); - -// component::mapping::nonlinear -extern void registerRigidMapping(sofa::core::ObjectFactory* factory); -// component::mass -extern void registerDiagonalMass(sofa::core::ObjectFactory* factory); -extern void registerMeshMatrixMass(sofa::core::ObjectFactory* factory); -extern void registerUniformMass(sofa::core::ObjectFactory* factory); +#include +#include -// component::mechanicalload -extern void registerConstantForceField(sofa::core::ObjectFactory* factory); -extern void registerEllipsoidForceField(sofa::core::ObjectFactory* factory); -extern void registerLinearForceField(sofa::core::ObjectFactory* factory); -extern void registerPlaneForceField(sofa::core::ObjectFactory* factory); -extern void registerSphereForceField(sofa::core::ObjectFactory* factory); - -// component::solidmechanics::fem::elastic -extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory); - -// component::solidmechanics::fem::hyperelastic -extern void registerStandardTetrahedralFEMForceField(sofa::core::ObjectFactory* factory); - -// component::solidmechanics::spring -extern void registerMeshSpringForceField(sofa::core::ObjectFactory* factory); -extern void registerQuadBendingSprings(sofa::core::ObjectFactory* factory); -extern void registerRestShapeSpringsForceField(sofa::core::ObjectFactory* factory); -extern void registerSpringForceField(sofa::core::ObjectFactory* factory); -extern void registerTriangleBendingSprings(sofa::core::ObjectFactory* factory); - -// component::solidmechanics::tensormass -extern void registerTetrahedralTensorMassForceField(sofa::core::ObjectFactory* factory); - -// component::statecontainer -extern void registerMechanicalObject(sofa::core::ObjectFactory* factory); - -// component::visualmodel -extern void registerVisualModel(sofa::core::ObjectFactory* factory); - -// component::collision::detection::intersection -extern void registerProximityIntersection(sofa::core::ObjectFactory* factory); - -// component::topology::container::dynamic -extern void registerPointSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); -extern void registerEdgeSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); -extern void registerTriangleSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); -extern void registerQuadSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); -extern void registerTetrahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); -extern void registerHexahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); - -// gui::component::performer; -extern void registerMouseInteractor(sofa::core::ObjectFactory* factory); +#include +#include -// SofaCUDA -extern void registerTetrahedronTLEDForceField(sofa::core::ObjectFactory* factory); -extern void registerHexahedronTLEDForceField(sofa::core::ObjectFactory* factory); +namespace sofacuda +{ -//Here are just several convenient functions to help user to know what contains the plugin extern "C" { -SOFA_GPU_CUDA_API void initExternalModule(); -SOFA_GPU_CUDA_API const char* getModuleName(); -SOFA_GPU_CUDA_API const char* getModuleVersion(); -SOFA_GPU_CUDA_API const char* getModuleLicense(); -SOFA_GPU_CUDA_API const char* getModuleDescription(); -SOFA_GPU_CUDA_API bool moduleIsInitialized(); -SOFA_GPU_CUDA_API void registerObjects(sofa::core::ObjectFactory* factory); -} - -bool isModuleInitialized = false; - -void init() -{ - static bool first = true; - if (first) - { - isModuleInitialized = sofa::gpu::cuda::mycudaInit(); - first = false; - } + SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); + SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -167,81 +52,38 @@ const char* getModuleVersion() return MODULE_VERSION; } -const char* getModuleLicense() +void registerObjects(sofa::core::ObjectFactory* factory) { - return "LGPL"; + factory->registerObjectsFromPlugin("SofaCUDA.Core"); + factory->registerObjectsFromPlugin("SofaCUDA.Component"); } -const char* getModuleDescription() +void init() { - return "GPU-based computing using NVIDIA CUDA"; + static bool first = true; + if (first) + { + // force dependencies at compile-time + sofacuda::core::init(); + sofacuda::component::init(); + + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + + first = false; + } } -bool moduleIsInitialized() +} // namespace sofacuda + +// compat +namespace sofa::gpu::cuda { - return isModuleInitialized; -} -void registerObjects(sofa::core::ObjectFactory* factory) +void init() { - registerLineCollisionModel(factory); - registerPointCollisionModel(factory); - registerSphereCollisionModel(factory); - registerTriangleCollisionModel(factory); - registerPenalityContactForceField(factory); - registerLinearSolverConstraintCorrection(factory); - registerPrecomputedConstraintCorrection(factory); - registerUncoupledConstraintCorrection(factory); - registerBilateralLagrangianConstraint(factory); - registerFixedProjectiveConstraint(factory); - registerFixedTranslationProjectiveConstraint(factory); - registerLinearMovementProjectiveConstraint(factory); - registerLinearVelocityProjectiveConstraint(factory); - registerBoxROI(factory); - registerNearestPointROI(factory); - registerSphereROI(factory); - registerIndexValueMapper(factory); - registerBarycentricMapping(factory); - registerBarycentricMapping_f(factory); - registerBarycentricMapping_3fRigid(factory); - registerBarycentricMapping_3f(factory); - registerBarycentricMapping_3f1(factory); - registerBarycentricMapping_3f1_f(factory); - registerBarycentricMapping_3f1_3f(factory); - registerBarycentricMapping_3f1_d(factory); - registerBeamLinearMapping(factory); - registerIdentityMapping(factory); - registerSubsetMapping(factory); - registerSubsetMultiMapping(factory); - registerRigidMapping(factory); - registerDiagonalMass(factory); - registerMeshMatrixMass(factory); - registerUniformMass(factory); - registerConstantForceField(factory); - registerEllipsoidForceField(factory); - registerLinearForceField(factory); - registerPlaneForceField(factory); - registerSphereForceField(factory); - registerHexahedronFEMForceField(factory); - registerTetrahedronFEMForceField(factory); - registerTriangularFEMForceFieldOptim(factory); - registerStandardTetrahedralFEMForceField(factory); - registerMeshSpringForceField(factory); - registerQuadBendingSprings(factory); - registerRestShapeSpringsForceField(factory); - registerSpringForceField(factory); - registerTriangleBendingSprings(factory); - registerTetrahedralTensorMassForceField(factory); - registerMechanicalObject(factory); - registerVisualModel(factory); - registerProximityIntersection(factory); - registerPointSetGeometryAlgorithms(factory); - registerEdgeSetGeometryAlgorithms(factory); - registerTriangleSetGeometryAlgorithms(factory); - registerQuadSetGeometryAlgorithms(factory); - registerTetrahedronSetGeometryAlgorithms(factory); - registerHexahedronSetGeometryAlgorithms(factory); - registerMouseInteractor(factory); + msg_warning("SofaCUDA") << "You must now call sofacuda::init() instead of sofa::gpu::cuda::init()"; + sofacuda::init(); } -} +} // sofa::gpu::cuda diff --git a/applications/plugins/SofaCUDA/src/SofaCUDA/init.h b/applications/plugins/SofaCUDA/src/SofaCUDA/init.h index 63695159787..8dfae267df1 100644 --- a/applications/plugins/SofaCUDA/src/SofaCUDA/init.h +++ b/applications/plugins/SofaCUDA/src/SofaCUDA/init.h @@ -1,4 +1,4 @@ -/****************************************************************************** +/****************************************************************************** * SOFA, Simulation Open-Framework Architecture * * (c) 2006 INRIA, USTL, UJF, CNRS, MGH * * * @@ -20,8 +20,17 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once + #include + +namespace sofacuda +{ + SOFACUDA_API void init(); +} // namespace sofacuda + +// compat namespace sofa::gpu::cuda { -SOFA_GPU_CUDA_API void init(); + SOFA_ATTRIBUTE_DEPRECATED("v26.06", "v26.12", "use sofacuda::init() instead") + SOFACUDA_API void init(); } // namespace sofa::gpu::cuda diff --git a/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaDataWidget.cpp b/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaDataWidget.cpp deleted file mode 100644 index 4150203d5b3..00000000000 --- a/applications/plugins/SofaCUDA/src/sofa/gpu/gui/CudaDataWidget.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#include -#include -#include -#include -#include -#include - -namespace sofa::qt -{ -using sofa::helper::Creator; -using namespace sofa::type; -using namespace sofa::defaulttype; - -Creator > > DWClass_Vec12i("default", true); - -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; - -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; - -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; - -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; -template class SOFA_GPU_CUDA_API TDataWidget >; - - -Creator, TABLE_HORIZONTAL > > DWClass_cudaVectori("default", true); -Creator, TABLE_HORIZONTAL > > DWClass_cudaVectorui("default", true); -Creator, TABLE_HORIZONTAL > > DWClass_cudaVectorf("default", true); -Creator, TABLE_HORIZONTAL > > DWClass_cudaVectord("default", true); - -Creator > > DWClass_cudaVectorVec1i("default", true); -Creator > > DWClass_cudaVectorVec2i("default", true); -Creator > > DWClass_cudaVectorVec3i("default", true); -Creator > > DWClass_cudaVectorVec4i("default", true); - -Creator > > DWClass_cudaVectorVec1f("default", true); -Creator > > DWClass_cudaVectorVec2f("default", true); -Creator > > DWClass_cudaVectorVec3f("default", true); -Creator > > DWClass_cudaVectorVec4f("default", true); - -Creator > > DWClass_cudaVectorVec1d("default", true); -Creator > > DWClass_cudaVectorVec2d("default", true); -Creator > > DWClass_cudaVectorVec3d("default", true); -Creator > > DWClass_cudaVectorVec4d("default", true); - - -} // namespace sofa::qt diff --git a/applications/plugins/SofaDistanceGrid/extensions/CUDA/src/SofaDistanceGrid/CUDA/CudaCollisionDistanceGrid.cpp b/applications/plugins/SofaDistanceGrid/extensions/CUDA/src/SofaDistanceGrid/CUDA/CudaCollisionDistanceGrid.cpp index de319b296d6..7245bc839ae 100644 --- a/applications/plugins/SofaDistanceGrid/extensions/CUDA/src/SofaDistanceGrid/CUDA/CudaCollisionDistanceGrid.cpp +++ b/applications/plugins/SofaDistanceGrid/extensions/CUDA/src/SofaDistanceGrid/CUDA/CudaCollisionDistanceGrid.cpp @@ -20,28 +20,16 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #include -#include -#include -#include -#include +#include #include #include #include "CudaDistanceGridCollisionModel.h" #include #include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include namespace sofa::component::collision::response::contact {