patch 13Dec16: neighbor refactor, Stan pppm/disp bug fix, M Brown INTEL package updates
This commit is contained in:
@ -18,12 +18,12 @@
|
||||
#include "error.h"
|
||||
|
||||
#if defined(LMP_USER_INTEL) && defined(__INTEL_COMPILER)
|
||||
#ifndef LMP_INTEL_NO_TBB
|
||||
#define LMP_USE_TBB_ALLOCATOR
|
||||
#include "tbb/scalable_allocator.h"
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN)
|
||||
#define LAMMPS_MEMALIGN 64
|
||||
#endif
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
@ -75,6 +75,15 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name)
|
||||
|
||||
#if defined(LMP_USE_TBB_ALLOCATOR)
|
||||
ptr = scalable_aligned_realloc(ptr, nbytes, LAMMPS_MEMALIGN);
|
||||
#elif defined(LMP_INTEL_NO_TBB) && defined(LAMMPS_MEMALIGN)
|
||||
ptr = realloc(ptr, nbytes);
|
||||
uintptr_t offset = ((uintptr_t)(const void *)(ptr)) % LAMMPS_MEMALIGN;
|
||||
if (offset) {
|
||||
void *optr = ptr;
|
||||
ptr = smalloc(nbytes, name);
|
||||
memcpy(ptr, optr, MIN(nbytes,malloc_usable_size(optr)));
|
||||
free(optr);
|
||||
}
|
||||
#else
|
||||
ptr = realloc(ptr,nbytes);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user