Skip to content

Commit

Permalink
[geogram] Update to 1.6.11
Browse files Browse the repository at this point in the history
  • Loading branch information
simogasp committed Mar 30, 2019
1 parent 1fcb713 commit ee093be
Show file tree
Hide file tree
Showing 88 changed files with 15,143 additions and 18,683 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ include(cmake/geogram.cmake)

set(VORPALINE_VERSION_MAJOR 1)
set(VORPALINE_VERSION_MINOR 6)
set(VORPALINE_VERSION_PATCH 10)
set(VORPALINE_VERSION_PATCH 11)
set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH})

set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR})
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindGeogram.cmake
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ find_library (GEOGRAM_GFX_LIBRARY
# system search path since it may be already installed
# in the system
find_library (GEOGRAM_GLFW3_LIBRARY
NAMES glfw3 glfw geogram_glfw3
NAMES glfw3 glfw geogram_glfw3 glfw3dll glfwdll
PATHS ${GEOGRAM_SEARCH_PATHS} ${GEOGRAM_SEARCH_PATHS_SYSTEM}
PATH_SUFFIXES lib
)
Expand All @@ -66,7 +66,7 @@ find_package_handle_standard_args(
# Create an imported target for Geogram
If (GEOGRAM_FOUND)

set(GEOGRAM_INSTALL_PREFIX ${GEOGRAM_INCLUDE_DIR}/..)
set(GEOGRAM_INSTALL_PREFIX ${GEOGRAM_INCLUDE_DIR}/../..)

if (NOT TARGET Geogram::geogram)
add_library (Geogram::geogram UNKNOWN IMPORTED)
Expand Down
7 changes: 3 additions & 4 deletions src/examples/geogram/simple_raytrace/raytracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ namespace GEO {
Y_ = cross(Z_,X_);

// Coordinate of the viewing plane along viewing vector
double zp = (
double(image_height_) / 2.0) / tan(zoom * M_PI / 180.0
);
double zp =
(double(image_height_) / 2.0) / tan(zoom * M_PI / 180.0);

// Center of the viewing plane
center_ = position_+zp*Z_;
Expand Down Expand Up @@ -323,7 +322,7 @@ namespace GEO {
Intersection() :
t(Numeric::max_float64()),
object(nullptr),
K(0.0, 0.0, 0.3) {
K(0.1, 0.1, 0.1) {
}
vec3 position; /**< position of the intersection. */
vec3 normal; /**< normal to the object. */
Expand Down
34 changes: 28 additions & 6 deletions src/lib/geogram/NL/nl_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ enum cudaMemcpyKind {

typedef int cudaError_t;

typedef cudaError_t (*FUNPTR_cudaDriverGetVersion)(int* version);
typedef cudaError_t (*FUNPTR_cudaRuntimeGetVersion)(int* version);
typedef cudaError_t (*FUNPTR_cudaGetDeviceCount)(int* device_count);
typedef cudaError_t (*FUNPTR_cudaGetDeviceProperties)(
struct cudaDeviceProp *props, int device
Expand Down Expand Up @@ -279,7 +281,7 @@ typedef cublasStatus_t (*FUNPTR_cublasDtpsv)(
* \details Function pointers are stored into the
* CUDAContext returned by the function CUDA().
* If a symbol is not found, returns NL_FALSE from the
* calling function. Here we use the functions prefixed
* calling function. Here we use the functions suffixed
* by "_v2".
*/
#define find_cublas_func(name) \
Expand All @@ -301,8 +303,7 @@ typedef cublasStatus_t (*FUNPTR_cublasDtpsv)(
* \details Function pointers are stored into the
* CUDAContext returned by the function CUDA().
* If a symbol is not found, returns NL_FALSE from the
* calling function. Here we use the functions prefixed
* by "_v2".
* calling function.
*/
#define find_cublas_func_v1(name) \
if( \
Expand Down Expand Up @@ -441,6 +442,9 @@ typedef cusparseStatus_t (*FUNPTR_cusparseDhybmv)(
*/
typedef struct {
NLdll DLL_cudart;

FUNPTR_cudaDriverGetVersion cudaDriverGetVersion;
FUNPTR_cudaRuntimeGetVersion cudaRuntimeGetVersion;
FUNPTR_cudaGetDeviceCount cudaGetDeviceCount;
FUNPTR_cudaGetDeviceProperties cudaGetDeviceProperties;
FUNPTR_cudaDeviceReset cudaDeviceReset;
Expand Down Expand Up @@ -497,6 +501,8 @@ static CUDAContext* CUDA() {
NLboolean nlExtensionIsInitialized_CUDA() {
if(
CUDA()->DLL_cudart == NULL ||
CUDA()->cudaDriverGetVersion == NULL ||
CUDA()->cudaRuntimeGetVersion == NULL ||
CUDA()->cudaGetDeviceCount == NULL ||
CUDA()->cudaGetDeviceProperties == NULL ||
CUDA()->cudaDeviceReset == NULL ||
Expand Down Expand Up @@ -614,9 +620,23 @@ static int getBestDeviceID() {
int max_compute_perf = 0, max_perf_device = 0;
int device_count = 0, best_SM_arch = 0;
int compute_perf = 0;
int driver_ver = 0;
int runtime_ver = 0;
struct cudaDeviceProp deviceProp;
CUDA()->cudaGetDeviceCount(&device_count);
int retval = CUDA()->cudaGetDeviceCount(&device_count);
if(retval == 35) {
nl_printf("Error: Driver/CUDA versions mismatch\n");
retval = CUDA()->cudaDriverGetVersion(&driver_ver);
nl_printf("cudaDriverGetVersion() retval=%d\n",retval);
retval = CUDA()->cudaRuntimeGetVersion(&runtime_ver);
nl_printf("cudaRuntimeGetVersion() retval=%d\n",retval);

nl_printf(" Driver version=%d\n",driver_ver);
nl_printf(" Runtime version=%d\n",driver_ver);
}

/* Find the best major SM Architecture GPU device */

while (current_device < device_count) {
CUDA()->cudaGetDeviceProperties(&deviceProp, current_device);
/* If this GPU is not running on Compute Mode prohibited,
Expand Down Expand Up @@ -667,7 +687,7 @@ static int getBestDeviceID() {
nl_printf(
"OpenNL CUDA: maximum device single-precision Gflops=%f\n",
(double)(2*max_compute_perf)/(double)(1e6)
);
);
*/

return max_perf_device;
Expand Down Expand Up @@ -706,14 +726,16 @@ NLboolean nlInitExtension_CUDA(void) {
LIBPREFIX "cudart" LIBEXTENSION, flags
);

find_cuda_func(cudaDriverGetVersion);
find_cuda_func(cudaRuntimeGetVersion);
find_cuda_func(cudaGetDeviceCount);
find_cuda_func(cudaGetDeviceProperties);
find_cuda_func(cudaDeviceReset);
find_cuda_func(cudaMalloc);
find_cuda_func(cudaFree);
find_cuda_func(cudaMemcpy);

CUDA()->devID = getBestDeviceID();
CUDA()->devID = getBestDeviceID();

if(CUDA()->cudaGetDeviceProperties(&deviceProp, CUDA()->devID)) {
nl_fprintf(stderr,"OpenNL CUDA: could not find a CUDA device\n");
Expand Down
31 changes: 31 additions & 0 deletions src/lib/geogram/basic/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,37 @@ namespace GEO {
}
}

/**
* \brief Copies all the values from another attribute.
* \param[in] rhs the attribute to be copied.
* \details rhs needs to have the same size and dimension
* as this Attribute.
*/
void copy(const Attribute<T>& rhs) {
geo_assert(rhs.size() == superclass::size());
geo_assert(rhs.dimension() == superclass::dimension());
for(index_t i=0; i<superclass::nb_elements(); ++i) {
(*this)[i] = rhs[i];
}
}

/**
* \brief Gets the pointer to the data.
* \return a pointer to the stored array.
*/
T* data() {
return (T*)AttributeStoreObserver::base_addr_;
}

/**
* \brief Gets the pointer to the data.
* \return a const pointer to the stored array.
*/
const T* data() const {
return (const T*)AttributeStoreObserver::base_addr_;
}


private:
/**
* \brief Forbids copy.
Expand Down
23 changes: 6 additions & 17 deletions src/lib/geogram/basic/command_line_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,21 +659,14 @@ namespace {
*/
void import_arg_group_gfx() {
declare_arg_group("gfx", "OpenGL graphics options", ARG_ADVANCED);


// Default profile will be "core" in a short future for all architectures,
// but some users reported problems with it, so I keep for now
// "compatibility" as the default (except on Mac/OS that prefers "core")
declare_arg(
"gfx:GL_profile",
#if defined(GEO_OS_APPLE)
#if defined(GEO_OS_ANDROID)
"ES",
#else
"core",
#elif defined(GEO_OS_ANDROID)
"ES",
#else
"compatibility",
#endif
"one of core,compatibility,ES"
"one of core,ES"
);
declare_arg(
"gfx:GL_version", 0.0,
Expand All @@ -683,17 +676,13 @@ namespace {
"gfx:GL_debug", false,
"OpenGL debugging context"
);
declare_arg(
"gfx:GLSL", true,
"Use GLSL shaders (requires a decently recent gfx board)"
);
declare_arg(
"gfx:GLSL_version", 0.0,
"If non-zero, overrides GLSL version detection"
);
declare_arg(
"gfx:GLUP_profile", "auto",
"one of auto, GLUP150, GLUP440, VanillaGL"
"one of auto, GLUP150, GLUP440, GLUPES"
);
declare_arg("gfx:full_screen", false, "full screen mode");
declare_arg(
Expand All @@ -707,7 +696,7 @@ namespace {
declare_arg(
"gfx:GLSL_tesselation", true, "use tesselation shaders if available"
);
declare_arg("gfx:geometry", "800x800", "resolution");
declare_arg("gfx:geometry", "1024x1024", "resolution");
}

/**
Expand Down
Loading

0 comments on commit ee093be

Please sign in to comment.