aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--config.h.cmake.in1
-rw-r--r--config.h.in1
-rw-r--r--meson.build32
-rw-r--r--src/gui_backend_slurm.c3
-rw-r--r--src/gui_project.c12
6 files changed, 49 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 222cb534..329e9677 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,11 @@ find_package(GSL REQUIRED)
find_package(OpenCL)
find_package(PkgConfig)
+# Find SLURM
+set(CMAKE_REQUIRED_LIBRARIES "-lslurm")
+check_symbol_exists(slurm_api_version "slurm/slurm.h" HAVE_SLURM)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
# Request HDF5 1.10-style API (can't use 1.12-style yet)
add_definitions(-DH5_USE_110_API)
@@ -406,13 +411,20 @@ if (GTK_FOUND)
set(CRYSTFEL_GUI_SOURCES src/crystfel_gui.c src/crystfelimageview.c
src/gui_peaksearch.c src/gui_index.c src/gui_backend_local.c
- src/gui_project.c src/crystfelindexingopts.c
- src/gui_backend_slurm.c)
+ src/gui_project.c src/crystfelindexingopts.c)
+
+ if (HAVE_SLURM)
+ set(CRYSTFEL_GUI_SOURCES ${CRYSTFEL_GUI_SOURCES} src/gui_backend_slurm.c)
+ endif (HAVE_SLURM)
add_executable(crystfel ${CRYSTFEL_GUI_SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/version.c)
target_include_directories(crystfel PRIVATE ${COMMON_INCLUDES} ${GTK_INCLUDE_DIRS})
- target_link_libraries(crystfel ${COMMON_LIBRARIES} util ${GTK_LIBRARIES})
+ target_link_libraries (crystfel ${COMMON_LIBRARIES} util ${GTK_LIBRARIES})
+
+ if (HAVE_SLURM)
+ target_link_libraries(crystfel slurm)
+ endif (HAVE_SLURM)
list(APPEND CRYSTFEL_EXECUTABLES crystfel)
diff --git a/config.h.cmake.in b/config.h.cmake.in
index ef53b3d1..d8c1cbfa 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -10,3 +10,4 @@
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_MSGPACK
#cmakedefine HAVE_ZMQ
+#cmakedefine HAVE_SLURM
diff --git a/config.h.in b/config.h.in
index 277f08fd..1d917494 100644
--- a/config.h.in
+++ b/config.h.in
@@ -10,3 +10,4 @@
#mesondefine HAVE_CLOCK_GETTIME
#mesondefine HAVE_MSGPACK
#mesondefine HAVE_ZMQ
+#mesondefine HAVE_SLURM
diff --git a/meson.build b/meson.build
index 81719e20..bef509ff 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,10 @@ mdep = cc.find_library('m', required : true)
gsldep = dependency('gsl', required : true)
zlibdep = dependency('zlib', required : true)
pthreaddep = dependency('threads', required : true)
+slurmdep = cc.find_library('slurm', required : false)
+if slurmdep.found()
+ conf_data.set10('HAVE_SLURM', 1)
+endif
# HDF5 >= 1.8.21 and >= 1.10.2 has a pkg-config file:
hdf5dep = dependency('hdf5', language : 'c', required : false)
@@ -195,18 +199,24 @@ executable('make_pixelmap',
# CrystFEL GUI
if gtkdep.found()
- executable('crystfel',
- ['src/crystfel_gui.c',
- 'src/crystfelimageview.c',
- 'src/crystfelindexingopts.c',
- 'src/gui_peaksearch.c',
- 'src/gui_index.c',
- 'src/gui_backend_local.c',
- 'src/gui_backend_slurm.c',
- 'src/gui_project.c',
- versionc],
- dependencies : [mdep, libcrystfeldep, gtkdep, gsldep],
+
+ gui_sources = ['src/crystfel_gui.c',
+ 'src/crystfelimageview.c',
+ 'src/crystfelindexingopts.c',
+ 'src/gui_peaksearch.c',
+ 'src/gui_index.c',
+ 'src/gui_backend_local.c',
+ 'src/gui_project.c',
+ versionc]
+
+ if slurmdep.found()
+ gui_sources += 'src/gui_backend_slurm.c'
+ endif
+
+ executable('crystfel', gui_sources,
+ dependencies : [mdep, libcrystfeldep, gtkdep, gsldep, slurmdep],
install : true)
+
endif
# render_hkl
diff --git a/src/gui_backend_slurm.c b/src/gui_backend_slurm.c
index c2b2b93e..dfd0d9f5 100644
--- a/src/gui_backend_slurm.c
+++ b/src/gui_backend_slurm.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <sys/wait.h>
#include <gtk/gtk.h>
+#include <slurm/slurm.h>
#include <utils.h>
@@ -79,6 +80,8 @@ static void *run_indexing(const char *job_title,
void *opts_priv)
{
//struct slurm_indexing_opts *opts = opts_priv;
+ STATUS("SLURM API version = %li\n",
+ slurm_api_version());
return NULL;
}
diff --git a/src/gui_project.c b/src/gui_project.c
index 637aa85d..7b9c44c8 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -559,17 +559,21 @@ void default_project(struct crystfelproject *proj)
proj->indexing_new_job_title = NULL;
/* FIXME: Crappy error handling */
- proj->n_backends = 2;
- proj->backends = malloc(proj->n_backends*sizeof(struct crystfel_backend));
+ proj->n_backends = 0;
+ proj->backends = malloc(2*sizeof(struct crystfel_backend));
if ( proj->backends == NULL ) {
ERROR("Couldn't allocate space for backends\n");
}
- if ( make_local_backend(&proj->backends[0]) ) {
+
+ if ( make_local_backend(&proj->backends[proj->n_backends++]) ) {
ERROR("Local backend setup failed\n");
}
- if ( make_slurm_backend(&proj->backends[1]) ) {
+
+ #ifdef HAVE_SLURM
+ if ( make_slurm_backend(&proj->backends[proj->n_backends++]) ) {
ERROR("SLURM backend setup failed\n");
}
+ #endif
/* Default parameter values */
proj->show_peaks = 0;