Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ endif()
include(${BLT_SOURCE_DIR}/SetupBLT.cmake)

add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()

include(CMakePackageConfigHelpers)

Expand Down
6 changes: 6 additions & 0 deletions include/adiak.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

#include <stddef.h>

#if defined(_MSC_VER)
#include <Windows.h>
#else
#include <sys/time.h>
#endif

#if defined(__cplusplus)
extern "C" {
#endif
Expand Down
6 changes: 3 additions & 3 deletions include/adiak_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ namespace adiak
return false;
}
element_type<T>::set(*value, valarray);
dtype->num_elements = c.size();
dtype->num_elements = (int) c.size();
return true;
}
};
Expand Down Expand Up @@ -281,9 +281,9 @@ namespace adiak

template <typename T>
struct set_tuple_type<T, 0> {
static void settype(adiak_datatype_t **dtypes) {
static void settype(adiak_datatype_t ** /*dtypes*/) {
}
static bool setvalue(T &c, adiak_value_t *values, adiak_datatype_t *dtype) {
static bool setvalue(T & /*c*/, adiak_value_t * /*values*/ , adiak_datatype_t * /*dtype*/) {
return true;
}
};
Expand Down
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ set(adiak_public_headers ../include/adiak.h ../include/adiak.hpp ../include/adia

if (APPLE)
set(adiak_sys_sources adksys_posix.c adksys_unix.c adksys_osx.c)
set(adiak_sys_depends)
elseif (UNIX)
set(adiak_sys_sources adksys_glibc.c adksys_posix.c adksys_procfs.c adksys_unix.c)
set(adiak_sys_depends dl)
elseif (WIN32)
set(adiak_sys_sources adksys_windows.c)
set(adiak_sys_depends Secur32 Ws2_32)
endif ()

if (MPI_FOUND)
Expand All @@ -21,7 +26,7 @@ endif()
blt_add_library( NAME adiak
HEADERS ${adiak_public_headers}
SOURCES adiak.c ${adiak_sys_sources} ${adiak_mpi_source}
DEPENDS_ON ${adiak_mpi_depends})
DEPENDS_ON ${adiak_mpi_depends} ${adiak_sys_depends})

install(FILES
${adiak_public_headers}
Expand Down
35 changes: 23 additions & 12 deletions src/adiak.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
//
// SPDX-License-Identifier: MIT

#if defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif

#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
Expand Down Expand Up @@ -354,7 +358,7 @@ static adiak_datatype_t *parse_typestr(const char *typestr, va_list *ap)
int end = 0;
int len;

len = strlen(typestr);
len = (int) strlen(typestr);
return parse_typestr_helper(typestr, 0, len, ap, &end);
}

Expand Down Expand Up @@ -768,6 +772,12 @@ int adiak_launchday()
return 0;
}

#if defined(_MSC_VER)
#define FILESEP '\\'
#else
#define FILESEP '/'
#endif

int adiak_executable()
{
char path[MAX_PATH_LEN+1];
Expand All @@ -778,7 +788,7 @@ int adiak_executable()
if (result == -1)
return -1;

filepart = strrchr(path, '/');
filepart = strrchr(path, FILESEP);
if (!filepart)
filepart = path;
else
Expand Down Expand Up @@ -966,9 +976,9 @@ int adiak_hostlist()
{
char **hostlist_array = NULL;
int num_hosts = 0, result = -1;
char *name_buffer = NULL;


#if defined(USE_MPI)
char* name_buffer = NULL;
if (adiak_config->use_mpi)
result = adksys_hostlist(&hostlist_array, &num_hosts, &name_buffer, adiak_config->report_on_all_ranks);
#endif
Expand All @@ -985,9 +995,9 @@ int adiak_num_hosts()
{
char **hostlist_array = NULL;
int num_hosts = 0, result = -1;
char *name_buffer = NULL;


#if defined(USE_MPI)
char* name_buffer = NULL;
if (adiak_config->use_mpi)
result = adksys_hostlist(&hostlist_array, &num_hosts, &name_buffer, adiak_config->report_on_all_ranks);
#endif
Expand All @@ -1002,9 +1012,10 @@ int adiak_num_hosts()

int adiak_job_size()
{
int result = -1, size = 1;
int size = 1;

#if defined(USE_MPI)
int result = -1;
if (adiak_config->use_mpi)
result = adksys_jobsize(&size);
if (result == -1)
Expand Down Expand Up @@ -1123,15 +1134,15 @@ static int adiak_type_string_helper(adiak_datatype_t *t, char *str, int len, int
if (!size_calc_only)
result = snprintf(str + pos, len - pos, "%s", simple);
else
result = strlen(simple);
result = (int) strlen(simple);
if (result != -1)
pos += result;
}
else if (lbracket) {
if (!size_calc_only)
result = snprintf(str + pos, len - pos, "%s", lbracket);
else
result = strlen(lbracket);
result = (int) strlen(lbracket);
if (result > 0) pos += result;
for (i = 0; i < t->num_subtypes; i++) {
pos += adiak_type_string_helper(t->subtype[i], str, len, pos, long_form, size_calc_only);
Expand All @@ -1146,7 +1157,7 @@ static int adiak_type_string_helper(adiak_datatype_t *t, char *str, int len, int
if (!size_calc_only)
result = snprintf(str + pos, len - pos, "%s", rbracket);
else
result = strlen(rbracket);
result = (int) strlen(rbracket);
if (result > 0) pos += result;
}
return pos - start_pos;
Expand All @@ -1164,8 +1175,8 @@ char *adiak_type_to_string(adiak_datatype_t *t, int long_form)

buffer = (char *) malloc(len + 1);
len2 = adiak_type_string_helper(t, buffer, len+1, 0, long_form, 0);
assert(len == len2);
buffer[len] = '\0';
assert(len == len2); (void) len2;
buffer[len] = '\0';

return buffer;
}
2 changes: 1 addition & 1 deletion src/adksys.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#if !defined(ADKSYS_H_)
#define ADKSYS_H_

#include <sys/time.h> /* struct timeval */
#include "adiak.h"

int adksys_get_libraries(char ***libraries, int *libraries_size, int *libnames_need_free);
int adksys_hostlist(char ***out_hostlist_array, int *out_num_hosts, char **out_name_buffer, int all_ranks);
Expand Down
1 change: 1 addition & 0 deletions src/adksys_mpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ static int gethostlist(char **hostlist, int *num_hosts, int *max_hostlen, int al
*hostlist = (char *) malloc(hostlist_size);
MPI_Bcast(*hostlist, hostlist_size, MPI_CHAR, 0, adiak_communicator);

(void) all_ranks;
return 0;
}

Expand Down
Loading