1
1
Fork 0

Правила сборки для ЗОСРВ "Нейтрино" редакции 2020

This commit is contained in:
parent 9ac5471035
commit 98c9b486d3
25 changed files with 276 additions and 3 deletions

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
LIST=OS
ifeq ($(BUILD_OPTION_DISABLE_GLVND),y)
EXCLUDE_OSLIST=nto
endif
include recurse.mk

14
README.md Normal file
View File

@ -0,0 +1,14 @@
Сборка проекта в ЗОСРВ "Нейтрино" редакции 2020
===============================================
Для всех архитектур:
```
make -j16 install
```
Только для x86:
```
CPULIST=x86 make -j16 install
```

53
common.mk Normal file
View File

@ -0,0 +1,53 @@
ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)
# Common build options
PATH_BUILDPREFIX=/usr
PATH_CONFPREFIX=/etc/openmpi
CFLAGS += -D__NetBSD__
CPPFLAGS += -D__NetBSD__
CXXFLAGS += -D__NetBSD__
CONFIGUREFLAGS += --prefix="$(PATH_BUILDPREFIX)"
CONFIGUREFLAGS += --sysconfdir="$(PATH_CONFPREFIX)"
CONFIGUREFLAGS += --disable-mpi-fortran
#~ CONFIGUREFLAGS += --with-ompi-pmix-rte
#~ CONFIGUREFLAGS += --with-orte
#~ CONFIGUREFLAGS += --with-hwloc=internal
#~ CONFIGUREFLAGS += --enable-debug
#~ CONFIGUREFLAGS += --without-orte
#~ CONFIGUREFLAGS += --without-flux-pmi
#~ CONFIGUREFLAGS += --disable-mca-dso
#~ CONFIGUREFLAGS += --disable-dlopen
#~ CONFIGUREFLAGS += --with-libevent=$(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)
#~ CONFIGUREFLAGS += --with-pmix=$(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)
POST_INSTALL = rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/bin/mpic*; \
rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/bin/mpiCC; \
rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/bin/mpif*; \
rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/bin/ortec*; \
rm -Rf $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/lib/pkgconfig; \
rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/lib/*.la; \
rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/lib/pmix/*.la; \
rm -f $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/lib/openmpi/*.la; \
rm -Rf $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/$(PATH_BUILDPREFIX)/share/man; \
\
{ \
flock 9; \
if [ ! -f "$(INSTALL_ROOT_HDR)/mpi.h" ]; then \
mkdir -p $(INSTALL_ROOT_HDR); \
cp -R $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/usr/include/* $(INSTALL_ROOT_HDR); \
fi; \
rm -Rf $(INSTALL_ROOT_$(OS))/$(CPUVARDIR)/usr/include; \
} 9>> $(PROJECT_ROOT)/post_install.lock
include $(MKFILES_ROOT)/autotools.mk
include $(MKFILES_ROOT)/qtargets.mk

View File

@ -43,6 +43,9 @@ AC_DEFUN([OPAL_INTL_PTHREAD_TRY_LINK], [
#
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <pthread.h>
#ifdef __KPDA__
#include <process.h>
#endif
int i = 3;
pthread_t me, newthread;
@ -95,6 +98,9 @@ cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#ifdef __KPDA__
#include <process.h>
#endif
$opal_conftest_h
#ifdef __cplusplus

2
nto/Makefile Normal file
View File

@ -0,0 +1,2 @@
LIST=CPU
include recurse.mk

8
nto/arm/Makefile Normal file
View File

@ -0,0 +1,8 @@
LIST=VARIANT
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif
include $(QRDIR)$(QRECURSE)

1
nto/arm/le.v7/Makefile Normal file
View File

@ -0,0 +1 @@
include ../../../common.mk

8
nto/mips/Makefile Normal file
View File

@ -0,0 +1,8 @@
LIST=VARIANT
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif
include $(QRDIR)$(QRECURSE)

1
nto/mips/be/Makefile Normal file
View File

@ -0,0 +1 @@
include ../../../common.mk

1
nto/mips/le/Makefile Normal file
View File

@ -0,0 +1 @@
include ../../../common.mk

2
nto/ppc/Makefile Normal file
View File

@ -0,0 +1,2 @@
LIST=VARIANT
include recurse.mk

View File

@ -0,0 +1 @@
include ../../../common.mk

1
nto/ppc/o.be/Makefile Normal file
View File

@ -0,0 +1 @@
include ../../../common.mk

2
nto/x86/Makefile Normal file
View File

@ -0,0 +1,2 @@
LIST=VARIANT
include recurse.mk

1
nto/x86/o/Makefile Normal file
View File

@ -0,0 +1 @@
include ../../../common.mk

View File

@ -25,6 +25,9 @@
#include "mpi.h"
#include <unistd.h>
#include <limits.h>
#ifdef __KPDA__
#include <sys/uio.h>
#endif /* __KPDA__ */
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
@ -235,7 +238,11 @@ ssize_t mca_fbtl_posix_preadv_generic (ompio_file_t *fh )
if (((((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
(ptrdiff_t)fh->f_io_array[i].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset)) &&
#ifndef __KPDA__
(iov_count < IOV_MAX ) ){
#else /* __KPDA__ */
(iov_count < UIO_MAXIOV ) ){
#endif /* __KPDA__ */
iov[iov_count].iov_base =
fh->f_io_array[i+1].memory_address;
iov[iov_count].iov_len = fh->f_io_array[i+1].length;

View File

@ -27,6 +27,9 @@
#include <unistd.h>
#include <sys/uio.h>
#include <limits.h>
#ifdef __KPDA__
#include <sys/uio.h>
#endif /* __KPDA__ */
#include "ompi/constants.h"
#include "ompi/mca/fbtl/fbtl.h"
@ -256,7 +259,11 @@ ssize_t mca_fbtl_posix_pwritev_generic (ompio_file_t *fh )
if ( (((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset +
(ptrdiff_t)fh->f_io_array[i].length) ==
(OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset) &&
#ifndef __KPDA__
(iov_count < IOV_MAX )) {
#else /* __KPDA__ */
(iov_count < UIO_MAXIOV )) {
#endif /* __KPDA__ */
iov[iov_count].iov_base = fh->f_io_array[i+1].memory_address;
iov[iov_count].iov_len = fh->f_io_array[i+1].length;
end_offset = (off_t)fh->f_io_array[i].offset + (off_t)fh->f_io_array[i].length;

View File

@ -21,6 +21,10 @@
#ifndef ADIO_INCLUDE
#define ADIO_INCLUDE
#ifdef __KPDA__
#include <stdint.h>
#endif /* __KPDA__ */
#ifdef SPPUX
#define _POSIX_SOURCE
#endif

View File

@ -98,6 +98,7 @@ for LARCH in $ARCHLIST ; do
FreeBSD) FARCH=freebsd ; break ;;
OpenBSD) FARCH=openbsd ; break ;;
NetBSD) FARCH=netbsd ; break ;;
KPDA) FARCH=netbsd ; break ;;
# The following are guesses
IP12|iris-4d) GARCH=IRIX ;;

View File

@ -342,7 +342,7 @@ AC_HEADER_TIME
dnl Checks for library functions.
AC_CHECK_FUNCS([gettimeofday vasprintf fcntl clock_gettime strtok_r strsep])
AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl])
AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl])
AC_CHECK_FUNCS([umask])
AC_CACHE_CHECK(

View File

@ -258,9 +258,14 @@ EOF])
AC_MSG_RESULT([FreeBSD])
hwloc_components="$hwloc_components freebsd"
;;
*-*-*netbsd*)
*-*-*netbsd*|*-*-*nto*|*-*-*qnx*|*-*-*kpda*|*kpda*)
AC_DEFINE(HWLOC_NETBSD_SYS, 1, [Define to 1 on *NETBSD])
hwloc_netbsd=yes
case ${target} in
*-*-*nto*|*-*-*qnx*|*-*-*kpda*|*kpda*)
hwloc_kpda=yes
;;
esac
AC_MSG_RESULT([NetBSD])
hwloc_components="$hwloc_components netbsd"
;;
@ -1244,6 +1249,7 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[
AM_CONDITIONAL([HWLOC_HAVE_DARWIN], [test "x$hwloc_darwin" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_FREEBSD], [test "x$hwloc_freebsd" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_NETBSD], [test "x$hwloc_netbsd" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_KPDA], [test "x$hwloc_kpda" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_SOLARIS], [test "x$hwloc_solaris" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_AIX], [test "x$hwloc_aix" = "xyes"])
AM_CONDITIONAL([HWLOC_HAVE_HPUX], [test "x$hwloc_hpux" = "xyes"])

View File

@ -150,7 +150,11 @@ endif HWLOC_HAVE_FREEBSD
if HWLOC_HAVE_NETBSD
sources += topology-netbsd.c
if HWLOC_HAVE_KPDA
ldflags += -lc
else
ldflags += -lpthread
endif
endif HWLOC_HAVE_NETBSD
if HWLOC_HAVE_X86_CPUID

View File

@ -24,6 +24,139 @@
#include <private/private.h>
#include <private/debug.h>
#ifdef __KPDA__
#include <fcntl.h>
#include <sys/procfs.h>
#include <sys/debug.h>
#include <sys/netmgr.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>
#include <sys/wait.h>
typedef void cpuset_t;
static inline size_t cpuset_size( const cpuset_t *set __hwloc_attribute_unused )
{
return (sizeof( int ) + 2 * RMSK_SIZE( _syspage_ptr->num_cpu ) * sizeof( unsigned )) / CHAR_BIT;
}
static cpuset_t * cpuset_create( void )
{
int *ptr = (int *)calloc( 1, cpuset_size( NULL ) * CHAR_BIT );
*ptr = RMSK_SIZE( _syspage_ptr->num_cpu );
return (void *)ptr;
}
static void cpuset_destroy( cpuset_t *set )
{
free( set );
}
static int cpuset_isset( unsigned cpu, const cpuset_t *set )
{
unsigned *runmask = (unsigned *)((char *)set + sizeof( int ));
if ( cpu > (unsigned)_syspage_ptr->num_cpu - 1 )
return (0);
return RMSK_ISSET( cpu, runmask );
}
static void cpuset_zero( cpuset_t *set )
{
memset( set, 0, cpuset_size( NULL ) * CHAR_BIT );
}
static int cpuset_set( unsigned cpu, cpuset_t *set )
{
unsigned *runmask = (unsigned *)((char *)set + sizeof( int ));
if ( cpu > (unsigned)_syspage_ptr->num_cpu - 1 )
return (-1);
RMSK_SET( cpu, runmask );
}
static int _procfs_cpuset( pid_t pid, pthread_t tid, cpuset_t *cpuset, int get )
{
procfs_threadctl *threadctl = alloca( sizeof( procfs_threadctl ) );
procfs_status status;
char path[64];
int fd, found, ret = -1;
if ( pid == 0 && tid == pthread_self() )
return ThreadCtl( _NTO_TCTL_RUNMASK_GET_AND_SET_INHERIT, cpuset ) == -1 ? -1 : 0;
memset( threadctl, 0, sizeof( procfs_threadctl ) );
threadctl->cmd = _NTO_TCTL_RUNMASK_GET_AND_SET_INHERIT;
memcpy( threadctl->data, cpuset, cpuset_size( NULL ) * CHAR_BIT );
/* _NTO_TCTL_RUNMASK* always needs O_RDWR so we can't fall back to O_RDONLY like in setprio_remote(). */
sprintf( path, "/proc/%d/as", pid );
if ( (fd = open( path, O_RDWR )) == -1 )
return -1;
/* Set all threads. DCMD_PROC_STOP issued for inherit above so that none are missed. */
for (found = 0, status.tid = 1;; status.tid++)
{
if ( tid != 0 )
if ( status.tid != tid )
continue;
if ( (ret = _devctl( fd, DCMD_PROC_TIDSTATUS, &status, sizeof( status ), _DEVCTL_FLAG_NORETVAL )) == -1 )
{
if ( errno == ESRCH && found )
ret = 0;
break;
}
threadctl->tid = status.tid;
/* Ignore ESRCH as the thread in question may have exited since being found above. */
if ( (ret = _devctl(fd, DCMD_PROC_THREADCTL, threadctl, sizeof( procfs_threadctl ), _DEVCTL_FLAG_NORETVAL)) != -1 )
found = 1;
else if ( errno != ESRCH )
break;
if ( get == 0 )
memcpy( threadctl->data, cpuset, cpuset_size( NULL ) * CHAR_BIT );
else {
memcpy( cpuset, threadctl->data, cpuset_size( NULL ) * CHAR_BIT );
break;
}
}
close(fd);
return ret == 0 ? 0 : -1;
}
static inline int sched_setaffinity_np( pid_t pid, size_t size __hwloc_attribute_unused, cpuset_t *cpuset )
{
return _procfs_cpuset( pid, 0, cpuset, 0 );
}
static inline int sched_getaffinity_np( pid_t pid, size_t size __hwloc_attribute_unused, cpuset_t *cpuset )
{
return _procfs_cpuset( pid, 0, cpuset, 1 );
}
static int pthread_setaffinity_np( pthread_t thread, size_t cpusetsize __hwloc_attribute_unused, const cpuset_t *cpuset )
{
return _procfs_cpuset( getpid(), thread, cpuset, 0 );
}
static int pthread_getaffinity_np( pthread_t thread, size_t cpusetsize __hwloc_attribute_unused, cpuset_t *cpuset )
{
return _procfs_cpuset( getpid(), thread, cpuset, 1 );
}
#endif /* __KPDA__ */
static void
hwloc_netbsd_bsd2hwloc(hwloc_bitmap_t hwloc_cpuset, const cpuset_t *cpuset)
{

View File

@ -124,6 +124,9 @@ libopalutil_la_LIBADD = \
libopalutil_la_DEPENDENCIES = \
keyval/libopalutilkeyval.la
# KPDA fix: because of "DEFAULT_INCLUDES = -I$(srcdir)" contains malloc.h and overrides system one
DEFAULT_INCLUDES = -I. -I$(top_builddir)/opal/include -I$(top_builddir)/ompi/include -I$(top_builddir)/oshmem/include -I$(top_builddir)/opal/mca/hwloc/hwloc201/hwloc/include/private/autogen -I$(top_builddir)/opal/mca/hwloc/hwloc201/hwloc/include/hwloc/autogen -I$(top_builddir)/ompi/mpiext/cuda/c
# Conditionally install the header files
if WANT_INSTALL_HEADERS

View File

@ -33,4 +33,4 @@
# be disabled by excluding the localhost RAS component by specifying
# the value "^localhost" [without the quotes] to the "ras" MCA
# parameter).
localhost slots=10